Ver código fonte

adjustments to wifi_switcher

cube 1 mês atrás
pai
commit
ce6f3f7231
1 arquivos alterados com 16 adições e 9 exclusões
  1. 16
    9
      CARDPUTER CircuitPython/wifi_switcher/code.py

+ 16
- 9
CARDPUTER CircuitPython/wifi_switcher/code.py Ver arquivo

@@ -3,8 +3,6 @@ import time, os, rtc, json, wifi, supervisor # type: ignore
3 3
 import board, busio, sdcardio, storage, terminalio, displayio # type: ignore
4 4
 from adafruit_display_text import label # type: ignore
5 5
 from adafruit_display_shapes.rect import Rect # type: ignore
6
-#import pytumblr # type: ignore
7
-import tumblrapi # type: ignore
8 6
 
9 7
 ### DEFAULT HOME PAGE # # # # # # # # # #
10 8
 def home():
@@ -79,8 +77,6 @@ while True:
79 77
         WIFI_PASS = wifi_options[pos][1]
80 78
         break
81 79
 
82
-
83
-# SET UP WIFI
84 80
 try:
85 81
     wifi.radio.connect(ssid=WIFI_SSID,
86 82
                     password=WIFI_PASS)
@@ -89,15 +85,26 @@ try:
89 85
     for lab in menu_labs:
90 86
         display.root_group.remove(lab)
91 87
 except ConnectionError as e:
88
+    h1.text = "Aw..."
89
+
90
+    for lab in menu_labs:
91
+        display.root_group.remove(lab)
92
+
92 93
     txt = label.Label(terminalio.FONT, text = "", color=0xff0000, scale=1)
93 94
     txt.text = "Could not connect to " + WIFI_SSID
94 95
     txt.x = 10
95
-    txt.y = 100
96
-    display.root_group.append(txt)
97
-    time.sleep(10)
98
-    supervisor.reload()
96
+    txt.y = 35
99 97
 
100
-# # # # # # # # # # # # # # # # # #
98
+    txt2 = label.Label(terminalio.FONT, text = "", color=0x89a0a8, scale=1)
99
+    txt2.text = "Press CTRL + C followed by CTRL + D\nto soft-reboot"
100
+    txt2.x = 10
101
+    txt2.y = 100
102
+
103
+    display.root_group.append(txt)
104
+    display.root_group.append(txt2)
105
+    
106
+    while True:
107
+        pass
101 108
 
102 109
 
103 110
 # SET UP SD CARD