aboutsummaryrefslogtreecommitdiff
path: root/dial.py
diff options
context:
space:
mode:
Diffstat (limited to 'dial.py')
-rw-r--r--dial.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/dial.py b/dial.py
index b6f3dd9..8fc92a9 100644
--- a/dial.py
+++ b/dial.py
@@ -10,10 +10,12 @@ REST_TIME = 0.3 # seconds
DIAL_RESET_TIME = 5 # seconds
class DialThread(threading.Thread):
- def __init__(self, queue):
+ def __init__(self, queue, phone_held, processing_event):
threading.Thread.__init__(self, args=(), kwargs=None)
self.queue = queue
self.daemon = True
+ self.phone_held = phone_held
+ self.processing_event = processing_event
GPIO.setmode(GPIO.BCM)
GPIO.setup(BUTTON_GPIO, GPIO.IN, pull_up_down=GPIO.PUD_UP)
@@ -37,7 +39,9 @@ class DialThread(threading.Thread):
rest_start = datetime.now()
pressed = False
if self.dial_over(rest_start) and not printed:
- self.queue.put(count % 10) # wrap 10 to 0
+ # Only add this dial to queue if we should accept numbers at this time
+ if self.phone_held.is_set() and not self.processing_event.is_set():
+ self.queue.put(count % 10) # wrap 10 to 0
count = 0
printed = True
time.sleep(0.01)