Skip to content
Snippets Groups Projects
Commit ccbb0da1 authored by koalo's avatar koalo
Browse files

Factory reset via menu.py

parent f012c7f7
No related branches found
No related tags found
No related merge requests found
......@@ -11,6 +11,9 @@ import display
import os
FACTORY_RESET_CMD = "! RESET !"
def list_apps():
"""Create a list of available apps."""
apps = sorted(os.listdir("."))
......@@ -21,6 +24,8 @@ def list_apps():
if "menu.py" in apps:
apps.remove("menu.py")
apps.append(FACTORY_RESET_CMD)
return apps
......@@ -83,11 +88,18 @@ def main():
# Select & start
disp.clear().update()
disp.close()
try:
os.exec(applist[current])
except OSError as e:
print("Loading failed: ", e)
os.exit(1)
if applist[current] == FACTORY_RESET_CMD:
files = os.listdir(".")
for f in files:
os.unlink(f)
os.exit(0)
else:
try:
os.exec(applist[current])
except OSError as e:
print("Loading failed: ", e)
os.exit(1)
draw_menu(disp, applist, current, 0)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment