X-Git-Url: https://oss.titaniummirror.com/gitweb/?a=blobdiff_plain;f=apps%2Ftests%2Frf230%2FRadioCountToDiag%2FRadioCountToDiagP.nc;h=0cf4d49c1dc5482a9e01ab37a455567abe5a7c24;hb=e9bfab607e051bae6afb47b44892ce37541d1b44;hp=ad9de621568c4a86a749a743e13f53aa6a3e7882;hpb=533f7abac18856ec06c61547be4915e98ff43cde;p=tinyos-2.x.git diff --git a/apps/tests/rf230/RadioCountToDiag/RadioCountToDiagP.nc b/apps/tests/rf230/RadioCountToDiag/RadioCountToDiagP.nc index ad9de621..0cf4d49c 100644 --- a/apps/tests/rf230/RadioCountToDiag/RadioCountToDiagP.nc +++ b/apps/tests/rf230/RadioCountToDiag/RadioCountToDiagP.nc @@ -41,11 +41,18 @@ module RadioCountToDiagP interface SplitControl as RadioControl; interface ActiveMessageAddress; + interface LowPowerListening; + + interface Leds; } } #ifndef SEND_PERIOD -#define SEND_PERIOD 10 +#define SEND_PERIOD 20 +#endif + +#ifndef SLEEP_INTERVAL +#define SLEEP_INTERVAL 50 #endif implementation @@ -62,6 +69,9 @@ implementation post radioPowerUp(); else { +#ifdef LOW_POWER_LISTENING + call LowPowerListening.setLocalWakeupInterval(SLEEP_INTERVAL); +#endif call SendTimer.startPeriodic(SEND_PERIOD); call ReportTimer.startPeriodic(1000); } @@ -99,7 +109,6 @@ implementation } uint32_t sendCount; - uint32_t sendError; uint32_t sendDoneSuccess; uint32_t sendDoneError; uint32_t ackedCount; @@ -109,10 +118,11 @@ implementation event void ReportTimer.fired() { + call Leds.led0Toggle(); + if( call DiagMsg.record() ) { call DiagMsg.uint16(sendCount); - call DiagMsg.uint16(sendError); call DiagMsg.uint16(sendDoneSuccess); call DiagMsg.uint16(sendDoneError); call DiagMsg.uint16(ackedCount); @@ -135,8 +145,13 @@ implementation { uint16_t addr; + call Leds.led1Toggle(); + call Packet.clear(&txMsg); call PacketAcknowledgements.requestAck(&txMsg); +#ifdef LOW_POWER_LISTENING + call LowPowerListening.setRemoteWakeupInterval(&txMsg, SLEEP_INTERVAL); +#endif addr = call ActiveMessageAddress.amAddress(); if( addr == 2 ) @@ -148,8 +163,6 @@ implementation if( call AMSend.send(addr, &txMsg, sizeof(ping_t)) == SUCCESS ) ++sendCount; - else - ++sendError; } event void AMSend.sendDone(message_t* msg, error_t error)