diff --git a/CARDPUTER CircuitPython/wifi_switcher/code.py b/CARDPUTER CircuitPython/wifi_switcher/code.py index 9d14749..5887422 100644 --- a/CARDPUTER CircuitPython/wifi_switcher/code.py +++ b/CARDPUTER CircuitPython/wifi_switcher/code.py @@ -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: