Add maintenance mode and board status indicators

Provide BOOT-triggered USB CDC maintenance mode for file updates, plus
onboard LED activity flashes and enhanced display status information.
This commit is contained in:
2026-08-27 20:33:24 +02:00
parent 2218b20bd8
commit 9e49484354
6 changed files with 317 additions and 184 deletions
+39
View File
@@ -0,0 +1,39 @@
"""Local USB-REPL maintenance-mode selection for the T-Dongle-S3."""
import time
from machine import Pin
# The T-Dongle-S3 BOOT switch connects GPIO0 to ground.
_BUTTON_PIN = 0
_WINDOW_MS = 1500
active = False
_button = None
def button_pressed():
"""Return whether the BOOT button is currently pressed."""
global _button
if _button is None:
_button = Pin(_BUTTON_PIN, Pin.IN, Pin.PULL_UP)
return not _button.value()
def check_button():
"""Return true when BOOT is pressed shortly after a normal reset.
Do not hold BOOT while resetting: GPIO0 is also an ESP ROM boot strap and
that combination intentionally enters the download bootloader instead.
"""
global active
deadline = time.ticks_add(time.ticks_ms(), _WINDOW_MS)
while time.ticks_diff(deadline, time.ticks_ms()) > 0:
if button_pressed():
# Debounce the switch and leave the user enough time to release it.
time.sleep_ms(40)
if button_pressed():
active = True
return True
time.sleep_ms(20)
active = False
return False