-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathboot.py
36 lines (35 loc) · 1023 Bytes
/
boot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# This file is executed on every boot (including wake-boot from deepsleep)
import badge, machine, esp, ugfx, sys
badge.init()
ugfx.init()
esp.rtcmem_write(0,0)
esp.rtcmem_write(1,0)
splash = badge.nvs_get_str('boot','splash','splash')
if machine.reset_cause() != machine.DEEPSLEEP_RESET:
print('[BOOT] Cold boot')
else:
print("[BOOT] Wake from sleep")
load_me = esp.rtcmem_read_string()
if load_me:
splash = load_me
print("starting %s" % load_me)
esp.rtcmem_write_string("")
try:
if not splash=="shell":
__import__(splash)
else:
ugfx.clear(ugfx.WHITE)
ugfx.flush(ugfx.LUT_FULL)
except BaseException as e:
sys.print_exception(e)
import easydraw
easydraw.msg("A fatal error occured!","Still Crashing Anyway", True)
easydraw.msg("")
easydraw.msg("Guru meditation:")
easydraw.msg(str(e))
easydraw.msg("")
easydraw.msg("Rebooting in 5 seconds...")
import time
time.sleep(5)
import appglue
appglue.home()