Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions server/app/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -822,8 +822,6 @@ def open_the_door(self):
GPIO.output(GPIO_LED_GREEN, GPIO.HIGH)

def timer_cycle(self):
self.thr = threading.Timer(0.6, BackgroundWorker.timer_cycle, [self])
self.thr.start()

self.requestTimer += 1

Expand Down Expand Up @@ -906,8 +904,8 @@ def timer_cycle(self):
print "Closing door"
GPIO.output(GPIO_RELAY, GPIO.HIGH)
self.ledState = self.LED_STATE_CLOSED
else:
GPIO.output(GPIO_RELAY, GPIO.HIGH)
#else:
# GPIO.output(GPIO_RELAY, GPIO.HIGH)

self.ledStateTimer += 1
if self.ledStateTimer >= 0:
Expand All @@ -923,6 +921,9 @@ def timer_cycle(self):
db.session.add(logentry)
db.session.commit()

# reschedule the timer cycle
self.thr = threading.Timer(0.6, BackgroundWorker.timer_cycle, [self])
self.thr.start()

def cancel(self):
if os.environ.get("WERKZEUG_RUN_MAIN") == "true":
Expand Down