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)