From 6768852636801aff1e4ef494c9b489000fb07fd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Ha=C3=9Fel?= Date: Sat, 28 Jun 2025 08:34:49 +0200 Subject: [PATCH] qr timeout --- Fotobox.py | 4 ++++ config.py | 1 + timer.py | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Fotobox.py b/Fotobox.py index fdacf2c..cef688b 100644 --- a/Fotobox.py +++ b/Fotobox.py @@ -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) diff --git a/config.py b/config.py index bac21ac..b924ac0 100644 --- a/config.py +++ b/config.py @@ -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 diff --git a/timer.py b/timer.py index 7e65812..f926984 100644 --- a/timer.py +++ b/timer.py @@ -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