Keeping the ESP8266 responsive...Best practices?

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
DorkOfOrk
Posts: 3
Joined: Sun Jan 24, 2021 2:33 pm

Keeping the ESP8266 responsive...Best practices?

Post by DorkOfOrk » Sun Jan 24, 2021 3:01 pm

Hello, my name is Dirk and I am new to this Forum.
I just try to find my way into this little universe and so I read a lot in the docs and in this forum lately.

At the moment my problem is, that I struggle to stop my esp8266 from outputting to the console and be responsive for file transfers and so. I hooked up a BMP180 Sensor and created a timer callback for reading and outputting values to the console. It is a real pain to try to stop that and change my program because it starts over after a hard reset. (My IDE is Thonny at the moment) Mostly I am only successful when I disconnect the sensor.
I could attach a switch so I could suppress these actions in the program depending on the switches position, but I would like to know if there is a simpler method to regain control or probably some best practices on how such programs have to be designed to prevent such behaviour.

Thanks in advance
Dirk

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Keeping the ESP8266 responsive...Best practices?

Post by pythoncoder » Sun Jan 24, 2021 4:57 pm

I'm not familiar with Thonny but in general you can interrupt a program with ctrl-c and ctrl-d does a soft reboot.
Peter Hinch
Index to my micropython libraries.

JennaSys
Posts: 33
Joined: Tue Jul 15, 2014 8:29 am
Location: Southern California, US
Contact:

Re: Keeping the ESP8266 responsive...Best practices?

Post by JennaSys » Tue Jul 27, 2021 1:32 am

Usually Ctrl-C in the Thonny REPL should stop whatever program is running. Next in line would be a Ctrl-D to do a soft reset of the device, then if things really get out of whack, Ctrl-F2 to restart the Thonny backend usually does the trick.

Usually during development, I'll manually start programs in the Thonny REPL instead of doing it automatically with main.py until the code is sound. That way if everything locks up, a brute force power cycle will get me back on line.
John Sheehan

Post Reply