Debounce, Service
This commit is contained in:
+5
-5
@@ -298,20 +298,20 @@ def main():
|
||||
door_sense.switch_to_input(digitalio.Pull.UP)
|
||||
|
||||
menu = StateMenu()
|
||||
btn_locked = False
|
||||
btn_locked = 0
|
||||
|
||||
try:
|
||||
while True:
|
||||
if not btn_oben.value:
|
||||
if not btn_locked:
|
||||
menu.button_pressed("oben")
|
||||
btn_locked = True
|
||||
btn_locked = 10
|
||||
elif not btn_unten.value:
|
||||
if not btn_locked:
|
||||
menu.button_pressed("unten")
|
||||
btn_locked = True
|
||||
else:
|
||||
btn_locked = False
|
||||
btn_locked = 10
|
||||
elif btn_locked:
|
||||
btn_locked -= 1
|
||||
|
||||
if door_sense.value != menu.doors["unten"].door_sense_state:
|
||||
menu.doors["unten"].door_sense_state = door_sense.value
|
||||
|
||||
Reference in New Issue
Block a user