Hi,
I am using MicroPython v1.9.4-272-g46091b8a (daily build) so I can make use of the two uos.dupterm() slots. I can see that by enabling WebREPL and doing nothing else, WebREPL is attached to slot 0 and UART 0 is attached to slot 1.
While developing and testing I'd like to exclusively use WebREPL, and use UART 0 for talking to my solar inverter via a MAX3232 (so disable REPL on/from UART 0).
I thought putting "uos.dupterm(None, 1)" at the end of my boot.py would do the trick, but is this not allowed as a safety measure?
It works fine if I manually type it into WebREPL after booting. This is displayed and the serial port no longer responds or updates:
>>> uos.dupterm(None, 1)
UART(0, baudrate=115200, bits=8, parity=None, stop=1, timeout=0, timeout_char=1)
>>>
I want to also say MicroPython is awesome, great job!
Cheers
Setting uos.dupterm() on boot
Re: Setting uos.dupterm() on boot
The default boot.py enables the UART for REPL. So if you comment out or delete that statement, UART will not even enabled for REPL.
Re: Setting uos.dupterm() on boot
Hi Robert,
Thanks for your reply!
I was using my own boot.py that did not have those default commands in it anymore. Just as a sanity check I wiped and reflashed the device and left the boot.py as-is, except for commenting out the two relevant lines, and running 'import webrepl_setup', which uncommented the webrepl.start() line. I also ran through the network setup to get the device to join my network (WebREPL connectivity has never been an issue though).
Here's what my boot.py looks like, and the UART still gets connected:
# This file is executed on every boot (including wake-boot from deepsleep)
#import esp
#esp.osdebug(None)
#import uos, machine
#uos.dupterm(machine.UART(0, 115200), 1)
import gc
import webrepl
webrepl.start()
gc.collect()
The only two files I have are boot.py and the password file for WebREPL:
>>> uos.listdir()
['boot.py', 'webrepl_cfg.py']
Does anyone else experience the same?
Cheers
Thanks for your reply!
I was using my own boot.py that did not have those default commands in it anymore. Just as a sanity check I wiped and reflashed the device and left the boot.py as-is, except for commenting out the two relevant lines, and running 'import webrepl_setup', which uncommented the webrepl.start() line. I also ran through the network setup to get the device to join my network (WebREPL connectivity has never been an issue though).
Here's what my boot.py looks like, and the UART still gets connected:
# This file is executed on every boot (including wake-boot from deepsleep)
#import esp
#esp.osdebug(None)
#import uos, machine
#uos.dupterm(machine.UART(0, 115200), 1)
import gc
import webrepl
webrepl.start()
gc.collect()
The only two files I have are boot.py and the password file for WebREPL:
>>> uos.listdir()
['boot.py', 'webrepl_cfg.py']
Does anyone else experience the same?
Cheers