Update 'CARDPUTER CircuitPython/wifi_switcher/code.py'
added "connecting..." message so it doesnt look like fail hang to user
This commit is contained in:
@@ -78,20 +78,26 @@ while True:
|
||||
break
|
||||
|
||||
try:
|
||||
for lab in menu_labs:
|
||||
display.root_group.remove(lab)
|
||||
|
||||
txt = label.Label(terminalio.FONT, text = "", color=0x00ff00, scale=1)
|
||||
txt.text = "Connecting to " + WIFI_SSID + "..."
|
||||
txt.x = 10
|
||||
txt.y = 35
|
||||
display.root_group.append(txt)
|
||||
|
||||
wifi.radio.connect(ssid=WIFI_SSID,
|
||||
password=WIFI_PASS)
|
||||
my_ip = str(wifi.radio.ipv4_address).strip()
|
||||
|
||||
display.root_group.remove(h1)
|
||||
for lab in menu_labs:
|
||||
display.root_group.remove(lab)
|
||||
display.root_group.remove(txt)
|
||||
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.text = "Could not connect to " + WIFI_SSID
|
||||
txt.color = 0xff0000
|
||||
txt.x = 10
|
||||
txt.y = 35
|
||||
|
||||
@@ -99,8 +105,7 @@ except ConnectionError as e:
|
||||
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:
|
||||
|
||||
Reference in New Issue
Block a user