]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - apps/tests/TestPowerManager/TestPowerManagerC.nc
Merge over into the trunk.
[tinyos-2.x.git] / apps / tests / TestPowerManager / TestPowerManagerC.nc
index 460e86385f8ccf74d6e2681414ebcc62103c1ad8..5264f9839af9a1d43feb0965df3e90656ea43f62 100644 (file)
@@ -75,8 +75,15 @@ implementation {
   event void TimerMilli.fired() {
     if(waiting == TRUE) {
       waiting = FALSE;
-      if(whoHasIt == 0)
-        call Resource1.request();
+      if(whoHasIt == 0)  {
+        if(call Resource1.immediateRequest() == SUCCESS) {
+          whoHasIt = 1;
+          call Leds.led2On();
+          call TimerMilli.startOneShot(HOLD_PERIOD);
+          return;
+        }
+        else call Resource1.request();
+      }
       if(whoHasIt == 1)
         call Resource0.request();
     }