-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathboot.py
More file actions
53 lines (41 loc) · 1.2 KB
/
Copy pathboot.py
File metadata and controls
53 lines (41 loc) · 1.2 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import sys, wifi, socketpool, ampule, time, os, json, microcontroller, storage
import load_settings
import digitalio, board
settings = load_settings.settings()
from load_screen import *
import check_button
from check_button import *
# from check_button import check_if_button_pressed
def boot_splash():
pprint("Booting...", line=0, color="white")
def check_if_button_pressed_on_boot():
try:
return time_button()
except Exception as e:
print(e)
return 1
def lock():
storage.disable_usb_drive()
storage.remount("/", False)
boot_splash()
if "unlock" in os.listdir():
lock()
try: os.remove("unlock")
except: pass
storage.enable_usb_drive()
pprint("Unlocking filesystem", line=1, color="red")
time.sleep(1)
elif check_if_button_pressed_on_boot():
pprint("Unlocking filesystem", line=1, color="red")
time.sleep(1)
else:
lock()
pprint("Hold to unlock", line=1, color="green")
#pprint("Locked filesystem")
time.sleep(1)
try: os.remove("code.py")
except: pass
try: os.remove("reboot_required")
except: pass
#try: clearscreen(True)
#except Exception as e: pprint(str(e))