I was running the Basic WiFi configuration script provided in help(). Unfortunately, I did a typo in one of the args for the .connect() method. Thereafter, my terminal was flooded with the family of msgs relating to "wifi: STA_DISCONNECTED, reason:15" which I understand it to mean "15 4-Way Handshake timeout". The stop the barrage of msgs, I did a Ctrl+C. That got me the >>> prompt but still it would subsequently be overtaken by error msgs. I tried Ctrl+D but that did not stop the constant stream of error msg. So I did a hard reset.
How do I terminate a background program/thread/function/method in uPy? Pardon my asking, I am new here.
In Linux, I use the ps cmd to see my processes and kill them accordingly. How do I do an equivalent here? Thanks.
How do I terminate a background program/thread/function/method in uPy?
Re: How do I terminate a background program/thread/function/method in uPy?
uPy runs 'on the bare metal', there is no such thing as a task manager or background process to 'break' a rouge piece of code.
I use a pyBoard, and the code lives on an SD-Card. If i stuff up, i pull the SD-card, put it in the laptop, change the code and the problem is solved. Happens pretty seldom, but it does.
There are other tricks, but one need to know a bit more about the hardware and the code you are using.
I use a pyBoard, and the code lives on an SD-Card. If i stuff up, i pull the SD-card, put it in the laptop, change the code and the problem is solved. Happens pretty seldom, but it does.
There are other tricks, but one need to know a bit more about the hardware and the code you are using.
Ivo Gorny
Re: How do I terminate a background program/thread/function/method in uPy?
I was running uPy on esp32 devkit v1 with no SD card. Any "trick" for this?
Will pulling out the SD-card for your system reduce the life-span of the card?
Will pulling out the SD-card for your system reduce the life-span of the card?
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: How do I terminate a background program/thread/function/method in uPy?
Re SD cards: best to power down the Pyboard first.
Re dodgy code this problem really only arises if you put code in main.py, because the code will automatically run (and fail) again if you reset the board. It's best to put code in your own module and test it at the REPL. That way you can stop it with ctrl-c or soft reset with ctrl-d.
If you want your application to auto-start, the very last thing to do once it's fully tested is to edit main.py to include a single line of code which starts your application.
Re dodgy code this problem really only arises if you put code in main.py, because the code will automatically run (and fail) again if you reset the board. It's best to put code in your own module and test it at the REPL. That way you can stop it with ctrl-c or soft reset with ctrl-d.
If you want your application to auto-start, the very last thing to do once it's fully tested is to edit main.py to include a single line of code which starts your application.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
-
- Posts: 169
- Joined: Fri Aug 19, 2016 11:55 am
Re: How do I terminate a background program/thread/function/method in uPy?
Try just ignoring the error messages and typing over them, I expect that even though you can’t see what you type, the REPL should still be functional and you should be able to turn off the WiFi that way.
Re: How do I terminate a background program/thread/function/method in uPy?
I came across this https://www.freertos.org/a00021.html#vTaskList. Are these task utilities exposed in any uPy module that a user can use on an esp32?
@pythoncoder Thanks for the "tips".
@pythoncoder Thanks for the "tips".