aboutsummaryrefslogtreecommitdiff
path: root/dial.py
diff options
context:
space:
mode:
Diffstat (limited to 'dial.py')
-rw-r--r--dial.py23
1 files changed, 10 insertions, 13 deletions
diff --git a/dial.py b/dial.py
index c5f556f..1d08a05 100644
--- a/dial.py
+++ b/dial.py
@@ -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 = []
+