Skip to content
Snippets Groups Projects
Commit e89a4a0c authored by rahix's avatar rahix
Browse files

Merge 'menu.py: after timeout go back to main.py'

See merge request card10/firmware!182
parents d744898d 58b5a17e
Branches
Tags
No related merge requests found
...@@ -16,6 +16,7 @@ import sys ...@@ -16,6 +16,7 @@ import sys
BUTTON_TIMER_POPPED = -1 BUTTON_TIMER_POPPED = -1
COLOR1, COLOR2 = (color.CHAOSBLUE_DARK, color.CHAOSBLUE) COLOR1, COLOR2 = (color.CHAOSBLUE_DARK, color.CHAOSBLUE)
MAXCHARS = 11 MAXCHARS = 11
HOMEAPP = "main.py"
def create_folders(): def create_folders():
...@@ -49,10 +50,10 @@ def list_apps(): ...@@ -49,10 +50,10 @@ def list_apps():
# add main application # add main application
for mainFile in os.listdir("/"): for mainFile in os.listdir("/"):
if mainFile == "main.py": if mainFile == HOMEAPP:
apps.append( apps.append(
[ [
"/main.py", "/%s" % HOMEAPP,
{ {
"author": "card10badge Team", "author": "card10badge Team",
"name": "Home", "name": "Home",
...@@ -219,6 +220,7 @@ def main(): ...@@ -219,6 +220,7 @@ def main():
timerscrollspeed = 1 timerscrollspeed = 1
timerstartscroll = 5 timerstartscroll = 5
timercountpopped = 0 timercountpopped = 0
timerinactivity = 100
for ev in button_events(10): for ev in button_events(10):
if numapps == 0: if numapps == 0:
disp.clear(color.COMMYELLOW) disp.clear(color.COMMYELLOW)
...@@ -259,6 +261,16 @@ def main(): ...@@ -259,6 +261,16 @@ def main():
): ):
lineoffset += 1 lineoffset += 1
if applist[0][0] == "/%s" % HOMEAPP and timercountpopped >= timerinactivity:
print("Inactivity timer popped")
disp.clear().update()
disp.close()
try:
os.exec("/%s" % HOMEAPP)
except OSError as e:
print("Loading failed: ", e)
os.exit(1)
elif ev == buttons.TOP_RIGHT: elif ev == buttons.TOP_RIGHT:
# Select & start # Select & start
disp.clear().update() disp.clear().update()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment