Skip to content

Commit

Permalink
Use supervisor.reload instead of microcontroller.reset as it's broken…
Browse files Browse the repository at this point in the history
… in 9.1.1 with tinyUF2 0.18.2
  • Loading branch information
tyeth committed Aug 14, 2024
1 parent 4db61f5 commit a14e92b
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import wifi
import board
import displayio
import microcontroller
import supervisor
import adafruit_connection_manager
import adafruit_requests
from adafruit_io.adafruit_io import IO_HTTP
Expand Down Expand Up @@ -113,9 +113,13 @@
total_seconds = time.mktime(now)
refresh_clock = ticks_add(refresh_clock, refresh_timer)
except Exception as e: # pylint: disable=broad-except
print("Some error occured, retrying via reset in 15seconds! -", e)
time.sleep(15)
microcontroller.reset()
print("Some error occured, retrying via supervisor.reload in 5seconds! -", e)
time.sleep(5)
# 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:
remaining = time.mktime(event_time) - total_seconds
Expand Down

0 comments on commit a14e92b

Please sign in to comment.