0

Disable Auto-reload and restart on crash
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Disable Auto-reload and restart on crash

by marcusone on Mon Apr 05, 2021 10:21 pm

I would like to disable Auto-reload (I don't want the device to restart on file changes, only when I CTRL-D or whatever is then needed).

Also, how can I get the board to auto restart after a crash? (MatrixPortal). Watchdog code in the docs doesn't seem to work.

Thank you!

marcusone
 
Posts: 18
Joined: Thu Jun 18, 2015 3:33 pm

Re: Disable Auto-reload and restart on crash

by dastels on Tue Apr 06, 2021 10:44 am

You can disable auto-reload on file changes from the REPL:
Code: Select all | TOGGLE FULL SIZE
>>> import supervisor
>>> supervisor.disable_autoreload()


You will have to manually restart CircuitPython when you update code, however, by using CTRL_D. You can re-enable autoreload in a similar fashion:
Code: Select all | TOGGLE FULL SIZE
>>> import supervisor
>>> supervisor.enable_autoreload()


Restarting after a crash... not sure as it will output the error and backtrace and drop you into the REPL.

Dave

dastels
 
Posts: 5884
Joined: Tue Oct 20, 2015 3:22 pm

Re: Disable Auto-reload and restart on crash

by tannewt on Tue Apr 06, 2021 11:57 am

Restarting after a Python exception can be done with a top level try/except clause that catches all exceptions.

tannewt
 
Posts: 2349
Joined: Thu Oct 06, 2016 8:48 pm

Re: Disable Auto-reload and restart on crash

by marcusone on Wed Apr 07, 2021 5:06 pm

Thank you! of course its a simple solution, i was thinking too hard about how to restart from a crash :) too used to C where it just panics and reboots.

marcusone
 
Posts: 18
Joined: Thu Jun 18, 2015 3:33 pm

Please be positive and constructive with your questions and comments.