Use supervisor.reload instead of microcontroller.reset as it's broken in 9.1.1 with tinyUF2 0.18.2
This commit is contained in:
parent
4db61f558f
commit
a14e92ba08
1 changed files with 8 additions and 4 deletions
|
|
@ -8,7 +8,7 @@ import time
|
||||||
import wifi
|
import wifi
|
||||||
import board
|
import board
|
||||||
import displayio
|
import displayio
|
||||||
import microcontroller
|
import supervisor
|
||||||
import adafruit_connection_manager
|
import adafruit_connection_manager
|
||||||
import adafruit_requests
|
import adafruit_requests
|
||||||
from adafruit_io.adafruit_io import IO_HTTP
|
from adafruit_io.adafruit_io import IO_HTTP
|
||||||
|
|
@ -113,9 +113,13 @@ while True:
|
||||||
total_seconds = time.mktime(now)
|
total_seconds = time.mktime(now)
|
||||||
refresh_clock = ticks_add(refresh_clock, refresh_timer)
|
refresh_clock = ticks_add(refresh_clock, refresh_timer)
|
||||||
except Exception as e: # pylint: disable=broad-except
|
except Exception as e: # pylint: disable=broad-except
|
||||||
print("Some error occured, retrying via reset in 15seconds! -", e)
|
print("Some error occured, retrying via supervisor.reload in 5seconds! -", e)
|
||||||
time.sleep(15)
|
time.sleep(5)
|
||||||
microcontroller.reset()
|
# Normally calling microcontroller.reset() would be the way to go, but due to
|
||||||
|
# a bug causing a reset into tinyUF2 bootloader mode we're instead going to
|
||||||
|
# disconnect wifi to ensure fresh connection + use supervisor.reload()
|
||||||
|
wifi.radio.enabled = False
|
||||||
|
supervisor.reload()
|
||||||
|
|
||||||
if ticks_diff(ticks_ms(), clock_clock) >= clock_timer:
|
if ticks_diff(ticks_ms(), clock_clock) >= clock_timer:
|
||||||
remaining = time.mktime(event_time) - total_seconds
|
remaining = time.mktime(event_time) - total_seconds
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue