Fix bug
The screen saver wouldn't launch
This commit is contained in:
parent
2703494296
commit
c4cbae7f68
@ -114,7 +114,6 @@ def draw_circle(oled, x0, y0, radius, color):
|
|||||||
# Screensaver function with circular wave animation
|
# Screensaver function with circular wave animation
|
||||||
def screensaver():
|
def screensaver():
|
||||||
"""
|
"""
|
||||||
<<<<<<< Updated upstream
|
|
||||||
Activate the screensaver with RF-AD animation.
|
Activate the screensaver with RF-AD animation.
|
||||||
|
|
||||||
This function activates the screensaver by displaying an RF-AD animation moving across the screen.
|
This function activates the screensaver by displaying an RF-AD animation moving across the screen.
|
||||||
@ -124,9 +123,6 @@ def screensaver():
|
|||||||
- screensaver_thread_running (bool): Flag indicating if the screensaver thread is running.
|
- screensaver_thread_running (bool): Flag indicating if the screensaver thread is running.
|
||||||
- last_activity_time (float): Timestamp of the last activity.
|
- last_activity_time (float): Timestamp of the last activity.
|
||||||
|
|
||||||
=======
|
|
||||||
Screensaver function with circular wave animation
|
|
||||||
>>>>>>> Stashed changes
|
|
||||||
"""
|
"""
|
||||||
global screensaver_active, screensaver_thread_running
|
global screensaver_active, screensaver_thread_running
|
||||||
text = "RF-AD"
|
text = "RF-AD"
|
||||||
@ -135,6 +131,7 @@ def screensaver():
|
|||||||
radius = 36
|
radius = 36
|
||||||
max_radius = 64 # Maximum radius for the animation
|
max_radius = 64 # Maximum radius for the animation
|
||||||
while screensaver_active:
|
while screensaver_active:
|
||||||
|
try:
|
||||||
oled.fill(0)
|
oled.fill(0)
|
||||||
oled.text(text, 44, 28)
|
oled.text(text, 44, 28)
|
||||||
|
|
||||||
@ -148,9 +145,11 @@ def screensaver():
|
|||||||
radius = 36
|
radius = 36
|
||||||
|
|
||||||
time.sleep(0.01)
|
time.sleep(0.01)
|
||||||
|
except Exception as e:
|
||||||
|
break
|
||||||
# Check for activity
|
# Check for activity
|
||||||
if time.time() - last_activity_time <= 60:
|
if time.time() - last_activity_time <= 60:
|
||||||
|
oled.fill(0)
|
||||||
screensaver_active = False
|
screensaver_active = False
|
||||||
screensaver_thread_running = False
|
screensaver_thread_running = False
|
||||||
break
|
break
|
||||||
@ -171,10 +170,10 @@ def start_screensaver_thread():
|
|||||||
if not screensaver_thread_running:
|
if not screensaver_thread_running:
|
||||||
screensaver_active = True
|
screensaver_active = True
|
||||||
screensaver_thread_running = True
|
screensaver_thread_running = True
|
||||||
_thread.start_new_thread(screensaver, ())
|
_thread.start_new_thread(screensaver,())
|
||||||
|
|
||||||
|
|
||||||
def handle_inactivity():
|
def handle_inactivity(timer):
|
||||||
"""
|
"""
|
||||||
Handle user inactivity by starting the screensaver if necessary.
|
Handle user inactivity by starting the screensaver if necessary.
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user