Detect if REPL is connected
-
How do you detect if there is a console connection present?
Use case is I don't want my device to go into deepsleep if I'm working on it. -
I have found myself stuck a few times with ESP8266 as well as ESP32 with exactly the same issue!
The Pyboard has a useful USB_VCP.isconnected method which does exactly the function you are after. However, I am not sure if ESP32 offers that function. Perhaps a Pycom github enhancement request?
As an interim measure I now put in a 30 second delay on a hard reset ( using machine.RESET_CAUSE) allowing me time to interrupt the script.
Not very elegant, but it works. -
@tobz If you have the chance to connect one of the modem control signals like RTS to a GPIO port, then you can use that one.
-
I had a similiar situation where I wish to disable WDT when using console.
I put a jumper cable in between ground and a pin. The check for it on bootup and then if pulled to ground will not start the WDT. -
I am using a W01 module connected via P0, P1 (the standard Rx/Tx lines of the serial REPL) to a FT232R serial-USB-interface. The FT232R is powered from USB.
By defining P0 (i.e. Rx) as input with pull down activated, it is possible to dectect if REPL (i.e. the USB) is connected (P0=1=yes)
It may be interesting to note that UART operation is not affected by having Rx(P0) declared as digital input simultaneously.By this method, the module detects a serial console during boot and continues in REPL mode. If there is no active serial connection detected, it autostarts its application.
I am not sure if this works with a Wipy since the serial-USB interface may be powered from the Wipy, possibly making the status of Rx independent of the USB cable connection.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login