Restart code when micropython throws error
-
Hi,
We have a device running on the field that uses the pysense board.
Sometimes the python code on the device crashes with the error "Pysense board not detected". When reset the device it works fine again. Now in the field I can't do this. So when this happens it just stops executing any code. Is there a possibility to just restart a python program when it crashes with a random error? (like you have restart=always on systemd on linux for example?)Thanks,
Marvin -
@aptusmarvin There is the machine.reset() method, which works like pushing the reset button. If you can detect the crash state by software, for instance if it throws an python exception, then you can call this.
-
@aptusmarvin
you can use also watchdog
https://docs.pycom.io/chapter/firmwareapi/pycom/machine/WDT.html -
This post is deleted!
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