more information in the logfile
[saartuer.git] / actor.py
index f2f1ad28b64cbf02d3ee1a2a6c82abce28f7e830..fb72df73b268a843843e56c2ab9a8ee5ed652e84 100644 (file)
--- a/actor.py
+++ b/actor.py
@@ -12,15 +12,19 @@ class Actor:
        CMD_RED_OFF   = 6
        
        class CMD():
-               def __init__(self, name, pin, tid, todo):
+               def __init__(self, name, pin, tid, todo, verbose = True):
                        self.name = name
                        self.pin = pin
                        self.tid = tid
                        self.todo = todo
+                       self.verbose = verbose
                        # don't do the GPIO setup here, the main init did not yet run
                
                def execute(self):
-                       logger.info("Actor: Running command %s" % self.name)
+                       if self.verbose:
+                               logger.info("Actor: Running command %s" % self.name)
+                       else:
+                               logger.debug("Actor: Running command %s" % self.name)
                        for (value, delay) in self.todo:
                                if value is not None:
                                        logger.debug("Actor: Setting pin %d to %d" % (self.pin, value))
@@ -32,10 +36,10 @@ class Actor:
                CMD_UNLOCK:  CMD("unlock",         pin=12, tid=0, todo=[(True, 0.3), (False, 0.1)]),
                CMD_LOCK:  CMD("lock",             pin=16, tid=0, todo=[(True, 0.3), (False, 0.1)]),
                CMD_BUZZ: CMD("buzz",              pin=22, tid=1, todo=[(True, 2.5), (False, 0.1)]),
-               CMD_GREEN_ON: CMD("green on",      pin=23, tid=2, todo=[(True, 0)]),
-               CMD_GREEN_OFF: CMD("green off",    pin=23, tid=2, todo=[(False, 0)]),
-               CMD_RED_ON: CMD("red on",          pin=26, tid=2, todo=[(True, 0)]),
-               CMD_RED_OFF: CMD("red off",        pin=26, tid=2, todo=[(False, 0)]),
+               CMD_GREEN_ON: CMD("green on",      pin=23, tid=2, verbose=False, todo=[(True, 0)]),
+               CMD_GREEN_OFF: CMD("green off",    pin=23, tid=2, verbose=False, todo=[(False, 0)]),
+               CMD_RED_ON: CMD("red on",          pin=26, tid=2, verbose=False, todo=[(True, 0)]),
+               CMD_RED_OFF: CMD("red off",        pin=26, tid=2, verbose=False, todo=[(False, 0)]),
        }
        
        def __init__(self):