--bug
authorBernhard Tittelbach <xro@realraum.at>
Tue, 8 Oct 2013 20:33:35 +0000 (20:33 +0000)
committerBernhard Tittelbach <xro@realraum.at>
Tue, 8 Oct 2013 20:33:35 +0000 (20:33 +0000)
go/r3-eventbroker_zmq/metamovement.go

index a24d4ed..3ccfd72 100644 (file)
@@ -30,7 +30,11 @@ func MetaEventRoutine_Movement(ps *pubsub.PubSub, granularity, gran_duration int
         case event := <- events_chan:
             switch event.(type) {
                 case r3events.MovementSensorUpdate:
-                    movement_window.Value =  (uint32) (movement_window.Value.(uint32)  + 1)
+                    if movement_window.Value == nil {
+                        movement_window.Value = uint32(1)
+                    } else {
+                        movement_window.Value = uint32(movement_window.Value.(uint32)  + 1)
+                    }
             }
         case gots := <- myticker.C:
             ts := gots.Unix()