]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - apps/tests/cc2420/LplBroadcastPeriodicDelivery/TestPeriodicP.nc
Updated behavior and comments
[tinyos-2.x.git] / apps / tests / cc2420 / LplBroadcastPeriodicDelivery / TestPeriodicP.nc
index d572ac0bb897d54f51c56208d08b4170dfc77fa6..fa5c1917f6629f7c14c1a105b0e594c100683389 100644 (file)
@@ -56,6 +56,8 @@ implementation {
   uint8_t count;
   message_t fullMsg;
   bool transmitter;
+
+  uint8_t lastCount;
   
   /**************** Prototypes ****************/
   task void send();
@@ -89,8 +91,20 @@ implementation {
   }
   
   event message_t *Receive.receive(message_t *msg, void *payload, uint8_t len) {
+    TestPeriodicMsg *periodicMsg = (TestPeriodicMsg *) payload;
+
     if(!transmitter) {
-      call Leds.led1Toggle();
+      if(lastCount == periodicMsg->count) {
+        call Leds.led0On();
+        call Leds.led1Off();
+      } else {
+        call Leds.led1On();
+        call Leds.led0Off();
+      }
+
+      lastCount = periodicMsg->count;
+
+      call Leds.led2Toggle();
     }
     return msg;
   }