adjustments to wifi_switcher

This commit is contained in:
2026-02-04 21:43:18 +00:00
parent cedb25e5bc
commit ce6f3f7231

View File

@@ -3,8 +3,6 @@ import time, os, rtc, json, wifi, supervisor # type: ignore
import board, busio, sdcardio, storage, terminalio, displayio # type: ignore import board, busio, sdcardio, storage, terminalio, displayio # type: ignore
from adafruit_display_text import label # type: ignore from adafruit_display_text import label # type: ignore
from adafruit_display_shapes.rect import Rect # type: ignore from adafruit_display_shapes.rect import Rect # type: ignore
#import pytumblr # type: ignore
import tumblrapi # type: ignore
### DEFAULT HOME PAGE # # # # # # # # # # ### DEFAULT HOME PAGE # # # # # # # # # #
def home(): def home():
@@ -79,8 +77,6 @@ while True:
WIFI_PASS = wifi_options[pos][1] WIFI_PASS = wifi_options[pos][1]
break break
# SET UP WIFI
try: try:
wifi.radio.connect(ssid=WIFI_SSID, wifi.radio.connect(ssid=WIFI_SSID,
password=WIFI_PASS) password=WIFI_PASS)
@@ -89,15 +85,26 @@ try:
for lab in menu_labs: for lab in menu_labs:
display.root_group.remove(lab) display.root_group.remove(lab)
except ConnectionError as e: except ConnectionError as e:
h1.text = "Aw..."
for lab in menu_labs:
display.root_group.remove(lab)
txt = label.Label(terminalio.FONT, text = "", color=0xff0000, scale=1) txt = label.Label(terminalio.FONT, text = "", color=0xff0000, scale=1)
txt.text = "Could not connect to " + WIFI_SSID txt.text = "Could not connect to " + WIFI_SSID
txt.x = 10 txt.x = 10
txt.y = 100 txt.y = 35
display.root_group.append(txt)
time.sleep(10)
supervisor.reload()
# # # # # # # # # # # # # # # # # # txt2 = label.Label(terminalio.FONT, text = "", color=0x89a0a8, scale=1)
txt2.text = "Press CTRL + C followed by CTRL + D\nto soft-reboot"
txt2.x = 10
txt2.y = 100
display.root_group.append(txt)
display.root_group.append(txt2)
while True:
pass
# SET UP SD CARD # SET UP SD CARD