aboutsummaryrefslogtreecommitdiff
path: root/hangup.py
diff options
context:
space:
mode:
authorMark Powers <mark@marks.kitchen>2021-08-15 04:52:18 +0100
committerMark Powers <mark@marks.kitchen>2021-08-15 04:52:18 +0100
commitdb747d54bece564ff881cda3e21e38b45c91f35e (patch)
tree55582958a39c48222d76022cc714d4aaf7875ab6 /hangup.py
parentdc62736d843949a4f6a01cbd1af09c25a38673a9 (diff)
Refactor some things
Diffstat (limited to 'hangup.py')
-rw-r--r--hangup.py16
1 files changed, 7 insertions, 9 deletions
diff --git a/hangup.py b/hangup.py
index cfe6bdf..152118f 100644
--- a/hangup.py
+++ b/hangup.py
@@ -5,11 +5,9 @@ import time
BUTTON_GPIO = 24
class HangUpThread(threading.Thread):
- def __init__(self, phone_held, phone_hung_up, dial_manager):
+ def __init__(self, phone):
threading.Thread.__init__(self, args=(), kwargs=None)
- self.phone_held = phone_held
- self.phone_hung_up = phone_hung_up
- self.dial_manager = dial_manager
+ self.phone = phone
self.daemon = True
GPIO.setmode(GPIO.BCM)
@@ -18,11 +16,11 @@ class HangUpThread(threading.Thread):
def run(self):
while True:
if not GPIO.input(BUTTON_GPIO):
- self.phone_held.clear()
- self.phone_hung_up.set()
- self.dial_manager.clear_sequence()
+ self.phone.phone_held.clear()
+ self.phone.phone_hung_up.set()
+ self.phone.dial_manager.clear_sequence()
else:
- self.phone_held.set()
- self.phone_hung_up.clear()
+ self.phone.phone_held.set()
+ self.phone.phone_hung_up.clear()
time.sleep(0.1)