forked from jeanGaston/RF-AD
Update screensaver
Add global variable for the timout delay
This commit is contained in:
parent
67a0def870
commit
70178fbbbd
@ -33,6 +33,7 @@ last_activity_time = time.time()
|
|||||||
screensaver_active = False
|
screensaver_active = False
|
||||||
screensaver_thread_running = False
|
screensaver_thread_running = False
|
||||||
inactivity_timer = Timer(-1)
|
inactivity_timer = Timer(-1)
|
||||||
|
SCREEN_TIMEOUT = 20
|
||||||
|
|
||||||
|
|
||||||
def init_oled():
|
def init_oled():
|
||||||
@ -150,8 +151,8 @@ def screensaver():
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
break
|
break
|
||||||
# Check for activity
|
# Check for activity
|
||||||
if time.time() - last_activity_time <= 60:
|
if time.time() - last_activity_time <= SCREEN_TIMEOUT:
|
||||||
oled.fill(0)
|
#oled.fill(0)
|
||||||
screensaver_active = False
|
screensaver_active = False
|
||||||
screensaver_thread_running = False
|
screensaver_thread_running = False
|
||||||
break
|
break
|
||||||
@ -183,7 +184,7 @@ def handle_inactivity(timer):
|
|||||||
has passed since the last activity, it starts the screensaver thread.
|
has passed since the last activity, it starts the screensaver thread.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if time.time() - last_activity_time > 60:
|
if time.time() - last_activity_time > SCREEN_TIMEOUT:
|
||||||
start_screensaver_thread()
|
start_screensaver_thread()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user