Skip to content

Commit a14e92b

Browse files
committed
Use supervisor.reload instead of microcontroller.reset as it's broken in 9.1.1 with tinyUF2 0.18.2
1 parent 4db61f5 commit a14e92b

File tree

1 file changed

+8
-4
lines changed
  • CircuitPython_Day_2024_Projects/Qualia_820x320_IO_Countdown

1 file changed

+8
-4
lines changed

CircuitPython_Day_2024_Projects/Qualia_820x320_IO_Countdown/code.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import wifi
99
import board
1010
import displayio
11-
import microcontroller
11+
import supervisor
1212
import adafruit_connection_manager
1313
import adafruit_requests
1414
from adafruit_io.adafruit_io import IO_HTTP
@@ -113,9 +113,13 @@
113113
total_seconds = time.mktime(now)
114114
refresh_clock = ticks_add(refresh_clock, refresh_timer)
115115
except Exception as e: # pylint: disable=broad-except
116-
print("Some error occured, retrying via reset in 15seconds! -", e)
117-
time.sleep(15)
118-
microcontroller.reset()
116+
print("Some error occured, retrying via supervisor.reload in 5seconds! -", e)
117+
time.sleep(5)
118+
# Normally calling microcontroller.reset() would be the way to go, but due to
119+
# a bug causing a reset into tinyUF2 bootloader mode we're instead going to
120+
# disconnect wifi to ensure fresh connection + use supervisor.reload()
121+
wifi.radio.enabled = False
122+
supervisor.reload()
119123

120124
if ticks_diff(ticks_ms(), clock_clock) >= clock_timer:
121125
remaining = time.mktime(event_time) - total_seconds

0 commit comments

Comments
 (0)