diff options
| author | Mark Powers <mark@marks.kitchen> | 2021-07-12 02:00:54 +0100 |
|---|---|---|
| committer | Mark Powers <mark@marks.kitchen> | 2021-07-12 02:00:54 +0100 |
| commit | 1edb32ec29ca3c1bf4d1a53215ecb2544aa04a6e (patch) | |
| tree | d770c0f3dd74dab11a5b13c54f37b14c81daa990 /dial.py | |
| parent | a981a50b0597498a9fc92249f93f940998455ca3 (diff) | |
Refactor code to support phone hangup button
Diffstat (limited to 'dial.py')
| -rw-r--r-- | dial.py | 23 |
1 files changed, 10 insertions, 13 deletions
@@ -3,14 +3,17 @@ import time import RPi.GPIO as GPIO import threading +import events + BUTTON_GPIO = 25 REST_TIME = 0.3 # seconds DIAL_RESET_TIME = 5 # seconds class DialThread(threading.Thread): - def __init__(self, queue): + def __init__(self, queue, pressed): threading.Thread.__init__(self, args=(), kwargs=None) self.queue = queue + self.pressed = pressed self.daemon = True GPIO.setmode(GPIO.BCM) @@ -52,18 +55,9 @@ class DialManager: def _load_sequences(self): self.sequences = { - 0: "operator", - 1: { - 2: "test_multiple" - }, - 2: "weather", - 3: "horrorscope", - 4: "", - 5: "", - 6: "", - 7: "fortune", - 8: "", - 9: "" + 0: events.OperatorEvent(self), + 4: {1: {1: events.DirectoryEvent(self)}}, + 7: events.FortuneEvent(self), } print(self.sequences) @@ -90,3 +84,6 @@ class DialManager: return sequences[digit] return recursive_find(self.sequence, self.sequences) + def clear_sequence(self): + self.sequence = [] + |
