cube 1 месяц назад
Родитель
Сommit
ce6f3f7231
1 измененных файлов: 16 добавлений и 9 удалений
  1. 16
    9
      CARDPUTER CircuitPython/wifi_switcher/code.py

+ 16
- 9
CARDPUTER CircuitPython/wifi_switcher/code.py Просмотреть файл

3
 import board, busio, sdcardio, storage, terminalio, displayio # type: ignore
3
 import board, busio, sdcardio, storage, terminalio, displayio # type: ignore
4
 from adafruit_display_text import label # type: ignore
4
 from adafruit_display_text import label # type: ignore
5
 from adafruit_display_shapes.rect import Rect # type: ignore
5
 from adafruit_display_shapes.rect import Rect # type: ignore
6
-#import pytumblr # type: ignore
7
-import tumblrapi # type: ignore
8
 
6
 
9
 ### DEFAULT HOME PAGE # # # # # # # # # #
7
 ### DEFAULT HOME PAGE # # # # # # # # # #
10
 def home():
8
 def home():
79
         WIFI_PASS = wifi_options[pos][1]
77
         WIFI_PASS = wifi_options[pos][1]
80
         break
78
         break
81
 
79
 
82
-
83
-# SET UP WIFI
84
 try:
80
 try:
85
     wifi.radio.connect(ssid=WIFI_SSID,
81
     wifi.radio.connect(ssid=WIFI_SSID,
86
                     password=WIFI_PASS)
82
                     password=WIFI_PASS)
89
     for lab in menu_labs:
85
     for lab in menu_labs:
90
         display.root_group.remove(lab)
86
         display.root_group.remove(lab)
91
 except ConnectionError as e:
87
 except ConnectionError as e:
88
+    h1.text = "Aw..."
89
+
90
+    for lab in menu_labs:
91
+        display.root_group.remove(lab)
92
+
92
     txt = label.Label(terminalio.FONT, text = "", color=0xff0000, scale=1)
93
     txt = label.Label(terminalio.FONT, text = "", color=0xff0000, scale=1)
93
     txt.text = "Could not connect to " + WIFI_SSID
94
     txt.text = "Could not connect to " + WIFI_SSID
94
     txt.x = 10
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
 # SET UP SD CARD
110
 # SET UP SD CARD