From 70178fbbbdb744591701aff88cf3bf6d2a7b0aae Mon Sep 17 00:00:00 2001 From: jeanGaston Date: Wed, 12 Jun 2024 08:59:34 +0200 Subject: [PATCH] Update screensaver Add global variable for the timout delay --- Client/main.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Client/main.py b/Client/main.py index 2478ed4..317eaf7 100644 --- a/Client/main.py +++ b/Client/main.py @@ -33,6 +33,7 @@ last_activity_time = time.time() screensaver_active = False screensaver_thread_running = False inactivity_timer = Timer(-1) +SCREEN_TIMEOUT = 20 def init_oled(): @@ -150,8 +151,8 @@ def screensaver(): except Exception as e: break # Check for activity - if time.time() - last_activity_time <= 60: - oled.fill(0) + if time.time() - last_activity_time <= SCREEN_TIMEOUT: + #oled.fill(0) screensaver_active = False screensaver_thread_running = False break @@ -183,7 +184,7 @@ def handle_inactivity(timer): 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()