button even detection
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user