Merge branch 'master' of ralfj.de:saartuer
authorRalf Jung <post@ralfj.de>
Thu, 24 Oct 2013 17:45:26 +0000 (19:45 +0200)
committerRalf Jung <post@ralfj.de>
Thu, 24 Oct 2013 17:45:26 +0000 (19:45 +0200)
Conflicts:
statemachine.py

statemachine.py
tuerd

index 3a27adaf8c58a5cd384c417283bf82236450e706..a3c4affb860ed23733d41fbef7f4868f22c9889e 100644 (file)
@@ -143,13 +143,14 @@ class StateMachine():
                def handle_pins_event(self):
                        pins = self.pins()
                        if not (pins.door_locked is None or pins.door_closed is None or pins.space_active is None or pins.bell_ringing is None):
-                               logger.info("All sensors got a value, switching to a proper state")
                                if self.fallback:
                                        logger.info("Going to StateFallback because running in fallback mode")
                                        return StateMachine.StateFallback(self.state_machine)
                                if pins.door_locked:
+                                       logger.info("All sensors got a value, switching to a proper state: Space is closed")
                                        return StateMachine.StateZu(self.state_machine)
                                else:
+                                       logger.info("All sensors got a value, switching to a proper state: Space is (about to) open")
                                        return StateMachine.StateAboutToOpen(self.state_machine)
                        return super().handle_pins_event()
        
@@ -176,8 +177,7 @@ class StateMachine():
                                        self.actor().act(Actor.CMD_LOCK)
                                t = threading.Thread(target=_close_after_time)
                                t.start()
-                       # without return because we want to stay in fallback mode
-                       super().handle_pins_event()
+                       # not calling superclass because we want to stay in fallback mode
                def handle_wakeup_event(self):
                        # blink red LED
                        now = time.time()
diff --git a/tuerd b/tuerd
index 50fe03f8b08a8e058c1fc093a1aa826d8d4791d9..92c4122c2cf0678e8f0fc20f875a3bf6ae481e6b 100755 (executable)
--- a/tuerd
+++ b/tuerd
@@ -22,6 +22,9 @@ else:
        # to avoid exceptions or getting None
        args.fallback = False
 
+# Not let's go!
+logger.info("Starting up...")
+
 # initialize GPIO stuff
 GPIO.setmode(GPIO.BOARD)