]> git.tdb.fi Git - r2c2.git/blobdiff - source/libmarklin/sensor.cpp
Forgot to add the new files
[r2c2.git] / source / libmarklin / sensor.cpp
index ff9594de60826ca69c2ef7c5660a5c5e6546a754..28f95482ab0b746652ed37bc0b44b31020cde22e 100644 (file)
@@ -1,3 +1,10 @@
+/* $Id$
+
+This file is part of the MSP Märklin suite
+Copyright © 2007-2008  Mikkosoft Productions, Mikko Rasa
+Distributed under the GPL
+*/
+
 #include <msp/time/utils.h>
 #include <msp/time/units.h>
 #include "control.h"
@@ -22,15 +29,15 @@ void Sensor::sensor_event(unsigned a, bool s)
        {
                if(s)
                {
-                       off_timeout=Time::TimeStamp();
+                       off_timeout = Time::TimeStamp();
                        if(s!=state)
                        {
-                               state=s;
+                               state = s;
                                signal_state_changed.emit(state);
                        }
                }
                else
-                       off_timeout=Time::now()+0.5*Time::sec;
+                       off_timeout = Time::now()+0.5*Time::sec;
        }
 }
 
@@ -38,13 +45,13 @@ void Sensor::tick()
 {
        if(off_timeout)
        {
-               const Time::TimeStamp t=Time::now();
+               const Time::TimeStamp t = Time::now();
                if(t>off_timeout)
                {
-                       off_timeout=Time::TimeStamp();
+                       off_timeout = Time::TimeStamp();
                        if(state)
                        {
-                               state=false;
+                               state = false;
                                signal_state_changed.emit(state);
                        }
                }