Clear screen with more efficient timeout

This commit is contained in:
David Todd 2020-01-27 18:57:40 -06:00
parent 434d722c5f
commit 327643f73c

View File

@ -67,12 +67,9 @@ if not STA_IF.isconnected():
connect(AP_IF, 'Access Point', creds.AP_SSID, creds.AP_PASSWORD) connect(AP_IF, 'Access Point', creds.AP_SSID, creds.AP_PASSWORD)
# If anything is connected, and it's been at least 30 seconds, clear the board # Clear the board with dissolve animation after 15 seconds
def timeout(): # We'll assume that the board is showing a green wifi logo
if is_connected(STA_IF) or is_connected(AP_IF) and time.time() - time_connected > 30: Timer(-1).init(
Pixo().transition_image_dissolve() period=15000,
tim.deinit() mode=Timer.ONE_SHOT,
callback=lambda t: Pixo().transition_image_dissolve())
# Check if the timeout is satisfied, every 30s
tim = Timer(-1)
tim.init(period=30000, mode=Timer.PERIODIC, callback=lambda t:timeout())