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
|
break
|
||||||
|
|
||||||
try:
|
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,
|
wifi.radio.connect(ssid=WIFI_SSID,
|
||||||
password=WIFI_PASS)
|
password=WIFI_PASS)
|
||||||
my_ip = str(wifi.radio.ipv4_address).strip()
|
my_ip = str(wifi.radio.ipv4_address).strip()
|
||||||
|
|
||||||
display.root_group.remove(h1)
|
display.root_group.remove(h1)
|
||||||
for lab in menu_labs:
|
display.root_group.remove(txt)
|
||||||
display.root_group.remove(lab)
|
|
||||||
except ConnectionError as e:
|
except ConnectionError as e:
|
||||||
h1.text = "Aw..."
|
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.text = "Could not connect to " + WIFI_SSID
|
||||||
|
txt.color = 0xff0000
|
||||||
txt.x = 10
|
txt.x = 10
|
||||||
txt.y = 35
|
txt.y = 35
|
||||||
|
|
||||||
@@ -100,7 +106,6 @@ except ConnectionError as e:
|
|||||||
txt2.x = 10
|
txt2.x = 10
|
||||||
txt2.y = 100
|
txt2.y = 100
|
||||||
|
|
||||||
display.root_group.append(txt)
|
|
||||||
display.root_group.append(txt2)
|
display.root_group.append(txt2)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
|||||||
Reference in New Issue
Block a user