Adding auto timeout for screen

This commit is contained in:
Tom Charnock 2025-01-03 20:43:16 +01:00
parent 4a145b2c3c
commit 4943ea9c15

12
code.py
View File

@ -361,11 +361,23 @@ def main(rate=0.05, start=3):
mode = 0
language = 0
backlight = True
counter = 0
while True:
_p, _m = poll()
t = release_countdown(_p, t, start=start)
tm = get_time(_m, tm)
if any(_p) or any(_m):
counter = 0
else:
if counter < 100:
counter += 1
if counter == 100:
tft_bl.value = False
elif counter == 0:
tft_bl.value = backlight
if all([_tm > 60 for _tm in tm]):
if not settings:
settings = True