button even detection
This commit is contained in:
parent
0e6a8d53eb
commit
5f38e3865e
@ -119,6 +119,12 @@ class GPIOButtonHandler:
|
|||||||
# Configure each button
|
# Configure each button
|
||||||
for button in self.buttons:
|
for button in self.buttons:
|
||||||
try:
|
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
|
# Configure pin
|
||||||
if self.pull_up:
|
if self.pull_up:
|
||||||
GPIO.setup(button.gpio, GPIO.IN, pull_up_down=GPIO.PUD_UP)
|
GPIO.setup(button.gpio, GPIO.IN, pull_up_down=GPIO.PUD_UP)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user