From 5f38e3865e74e0847c64e7bebb0b2a5ed46e08a2 Mon Sep 17 00:00:00 2001 From: Duncan Tourolle Date: Sun, 23 Nov 2025 14:37:03 +0100 Subject: [PATCH] button even detection --- dreader/gpio_buttons.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dreader/gpio_buttons.py b/dreader/gpio_buttons.py index b94e407..8ab2d59 100644 --- a/dreader/gpio_buttons.py +++ b/dreader/gpio_buttons.py @@ -119,6 +119,12 @@ class GPIOButtonHandler: # Configure each button for button in self.buttons: try: + # Clean up any existing event detection on this pin + try: + GPIO.remove_event_detect(button.gpio) + except Exception: + pass # Ignore if no event detection was set + # Configure pin if self.pull_up: GPIO.setup(button.gpio, GPIO.IN, pull_up_down=GPIO.PUD_UP)