Page 1 of 1

Keeping the ESP8266 responsive...Best practices?

Posted: Sun Jan 24, 2021 3:01 pm
by DorkOfOrk
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

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

Posted: Sun Jan 24, 2021 4:57 pm
by pythoncoder
I'm not familiar with Thonny but in general you can interrupt a program with ctrl-c and ctrl-d does a soft reboot.

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

Posted: Tue Jul 27, 2021 1:32 am
by JennaSys
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.