|
@@ -153,26 +153,42 @@ def state_machine(lcd):
|
153
|
153
|
from lcd import LCD
|
154
|
154
|
lcd = LCD()
|
155
|
155
|
|
156
|
|
-# splash screen
|
157
|
|
-lcd.fill(lcd.black)
|
158
|
|
-lcd.textC("S&B Volcano Remote", int(lcd.width / 2), 10, lcd.green)
|
159
|
|
-lcd.textC("by xythobuz", int(lcd.width / 2), 20, lcd.yellow)
|
160
|
|
-lcd.textC("Initializing...", int(lcd.width / 2), 30, lcd.white)
|
161
|
|
-lcd.textC(os.uname()[0][ 0 : 30], int(lcd.width / 2), lcd.height - 50, lcd.green)
|
162
|
|
-lcd.textC(os.uname()[3][ 0 : 30], int(lcd.width / 2), lcd.height - 40, lcd.yellow)
|
163
|
|
-lcd.textC(os.uname()[3][30 : 60], int(lcd.width / 2), lcd.height - 30, lcd.yellow)
|
164
|
|
-lcd.textC(os.uname()[4][ 0 : 30], int(lcd.width / 2), lcd.height - 20, lcd.white)
|
165
|
|
-lcd.textC(os.uname()[4][30 : 60], int(lcd.width / 2), lcd.height - 10, lcd.white)
|
166
|
|
-lcd.show()
|
167
|
|
-lcd.brightness(1.0)
|
168
|
|
-
|
169
|
|
-# bootloader access with face buttons
|
170
|
|
-keys = lcd.buttons()
|
171
|
|
-if keys.once("a") and keys.once("b"):
|
172
|
|
- machine.bootloader()
|
|
156
|
+def main():
|
|
157
|
+ # splash screen
|
|
158
|
+ from state_wait_temp import from_hsv
|
|
159
|
+ for x in range(0, lcd.width):
|
|
160
|
+ hue = x / (lcd.width - 1)
|
|
161
|
+ r, g, b = from_hsv(hue, 1.0, 1.0)
|
|
162
|
+ c = lcd.color(r, g, b)
|
|
163
|
+ lcd.rect(x, 0, 1, lcd.height, c)
|
|
164
|
+
|
|
165
|
+ lcd.textC("S&B Volcano Remote", int(lcd.width / 2), 10, lcd.green, lcd.black)
|
|
166
|
+ lcd.textC("by xythobuz", int(lcd.width / 2), 20, lcd.yellow, lcd.black)
|
|
167
|
+ lcd.textC("Initializing...", int(lcd.width / 2), 30, lcd.white, lcd.black)
|
|
168
|
+
|
|
169
|
+ import _git
|
|
170
|
+ lcd.textC(_git.git_branch, int(lcd.width / 2), int(lcd.height / 2) - 10, lcd.green, lcd.black)
|
|
171
|
+ lcd.textC(_git.git_hash, int(lcd.width / 2), int(lcd.height / 2), lcd.yellow, lcd.black)
|
|
172
|
+ lcd.textC(_git.build_date, int(lcd.width / 2), int(lcd.height / 2) + 10, lcd.white, lcd.black)
|
|
173
|
+
|
|
174
|
+ lcd.textC(os.uname()[0][ 0 : 30], int(lcd.width / 2), lcd.height - 50, lcd.green, lcd.black)
|
|
175
|
+ lcd.textC(os.uname()[3][ 0 : 30], int(lcd.width / 2), lcd.height - 40, lcd.yellow, lcd.black)
|
|
176
|
+ lcd.textC(os.uname()[3][30 : 60], int(lcd.width / 2), lcd.height - 30, lcd.yellow, lcd.black)
|
|
177
|
+ lcd.textC(os.uname()[4][ 0 : 30], int(lcd.width / 2), lcd.height - 20, lcd.white, lcd.black)
|
|
178
|
+ lcd.textC(os.uname()[4][30 : 60], int(lcd.width / 2), lcd.height - 10, lcd.white, lcd.black)
|
|
179
|
+
|
|
180
|
+ lcd.show()
|
|
181
|
+ lcd.brightness(1.0)
|
|
182
|
+
|
|
183
|
+ # bootloader access with face buttons
|
|
184
|
+ keys = lcd.buttons()
|
|
185
|
+ if keys.once("a") and keys.once("b"):
|
|
186
|
+ machine.bootloader()
|
173
|
187
|
|
174
|
|
-try:
|
175
|
188
|
state_machine(lcd)
|
|
189
|
+
|
|
190
|
+try:
|
|
191
|
+ main()
|
176
|
192
|
except Exception as e:
|
177
|
193
|
sys.print_exception(e)
|
178
|
194
|
|