Commit 2aa5af75 authored by Ralf's avatar Ralf
Browse files

More logging in StateFallback

parent e95422a3
......@@ -198,18 +198,25 @@ class StateMachine():
self.api().set_state(False)
def handle_pins_event(self):
pins = self.pins()
old_pins = self.old_pins()
# set green LED according to space switch
if pins.space_active:
self.actor().act(Actor.CMD_GREEN_ON)
else:
self.actor().act(Actor.CMD_GREEN_OFF)
# primitive leaving procedure if space switch turned off
if not pins.space_active and self.old_pins().space_active:
logger.info("Space was disabled, locking the door in {0} seconds".format(FALLBACK_LEAVE_DELAY_LOCK))
if not pins.space_active and old_pins.space_active:
logger.info("StateFallback: Space was disabled, locking the door in {0} seconds".format(FALLBACK_LEAVE_DELAY_LOCK))
self._nerver = Nerver([(FALLBACK_LEAVE_DELAY_LOCK, lambda:self.actor().act(Actor.CMD_LOCK))])
if pins.space_active and pins.bell_ringing and not self.old_pins().bell_ringing:
if pins.space_active and not old_pins.space_active:
logger.info("StateFallback: Space was enabled")
if pins.door_locked and not old_pins.door_locked:
logger.info("StateFallback: Door got locked")
if not pins.door_locked and old_pins.door_locked:
logger.info("StateFallback: Door got unlocked")
if pins.space_active and pins.bell_ringing and not old_pins.bell_ringing:
# someone just pressed the bell
logger.info("StateMachine: buzzing because of bell ringing in StateFallback")
logger.info("StateFallback: bell rings, let's buzz")
self.actor().act(Actor.CMD_BUZZ)
# not calling superclass because we want to stay in fallback mode
def handle_wakeup_event(self):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment