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
-
This post is deleted!
-
@aptusmarvin
you can use also watchdog
https://docs.pycom.io/chapter/firmwareapi/pycom/machine/WDT.html
-
@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.