qr timeout

This commit is contained in:
Patrick Haßel 2025-06-28 08:34:49 +02:00
parent efa8995887
commit 6768852636
3 changed files with 6 additions and 1 deletions

View File

@ -114,6 +114,7 @@ class Fotobox:
self._choice: Photo | None = None
self._countdown_timer: Timer = Timer("countdown", 0, 1, COUNTDOWN_COUNT + 1, self._countdown_callback)
self._shooting_timer: Timer = Timer("shooting", 0, SHOOTING_INTERVAL, SHOOTING_COUNT, self._shooting_callback)
self._qr_timer: Timer = Timer("qr", 0, QR_TIMEOUT, 1, self._qr_callback)
self._fotobox_uuid = read("./data/fotobox.uuid")
print("Starting fotobox: F-%s" % self._fotobox_uuid)
@ -164,6 +165,9 @@ class Fotobox:
self._draw_live_frame()
pygame.display.flip()
def _qr_callback(self):
self._set_state(State.IDLE)
def run(self):
if DEBUG:
self._set_state(State.SHOOTING)

View File

@ -20,6 +20,7 @@ PHOTO_HEIGHT = 1944
SHOOTING_COUNT: int = 1 if DEBUG else 2
SHOOTING_INTERVAL: float = 0 if DEBUG else 1.75
COUNTDOWN_COUNT: int = 0 if DEBUG else 3
QR_TIMEOUT: int = 3
CHOICE_BORDER: int = 5

View File

@ -22,7 +22,7 @@ class Timer:
self._rest = self._initial
def tick(self, dt: float):
if not self._enabled or self._current >= self._count:
if not self._enabled or self._seconds == 0 or self._current >= self._count:
return
self._rest -= dt