Increase the required non-activity periods before turning off the radio; remove the strict phase requirement (which messes up things with low-power streaming)

This commit is contained in:
adamdunkels 2010-03-17 16:35:52 +00:00
parent 1a9e00ab78
commit efeb9944fa

View File

@ -28,7 +28,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* $Id: contikimac.c,v 1.13 2010/03/16 18:11:13 adamdunkels Exp $ * $Id: contikimac.c,v 1.14 2010/03/17 16:35:52 adamdunkels Exp $
*/ */
/** /**
@ -279,12 +279,13 @@ powercycle(struct rtimer *t, void *ptr)
t0 = RTIMER_NOW(); t0 = RTIMER_NOW();
if(we_are_sending == 0) { if(we_are_sending == 0) {
powercycle_turn_radio_on(); powercycle_turn_radio_on();
#if 0
#if NURTIMER #if NURTIMER
while(RTIMER_CLOCK_LT(t0, RTIMER_NOW(), t0 + CCA_CHECK_TIME)); while(RTIMER_CLOCK_LT(t0, RTIMER_NOW(), t0 + CCA_CHECK_TIME));
#else #else
while(RTIMER_CLOCK_LT(RTIMER_NOW(), t0 + CCA_CHECK_TIME)); while(RTIMER_CLOCK_LT(RTIMER_NOW(), t0 + CCA_CHECK_TIME));
#endif #endif
#endif /* 0 */
/* Check if a packet is seen in the air. If so, we keep the /* Check if a packet is seen in the air. If so, we keep the
radio on for a while (LISTEN_TIME_AFTER_PACKET_DETECTED) to radio on for a while (LISTEN_TIME_AFTER_PACKET_DETECTED) to
be able to receive the packet. We also continuously check be able to receive the packet. We also continuously check
@ -336,7 +337,7 @@ powercycle(struct rtimer *t, void *ptr)
leds_off(LEDS_RED); leds_off(LEDS_RED);
break; break;
} }
if(periods > 10 && !(NETSTACK_RADIO.receiving_packet() || if(periods > 20 && !(NETSTACK_RADIO.receiving_packet() ||
NETSTACK_RADIO.pending_packet())) { NETSTACK_RADIO.pending_packet())) {
leds_on(LEDS_GREEN); leds_on(LEDS_GREEN);
powercycle_turn_radio_off(); powercycle_turn_radio_off();
@ -636,9 +637,9 @@ send_packet(mac_callback_t mac_callback, void *mac_callback_ptr)
RTIMER_CLOCK_LT(RTIMER_NOW(), t0 + STROBE_TIME); strobes++) { RTIMER_CLOCK_LT(RTIMER_NOW(), t0 + STROBE_TIME); strobes++) {
#endif #endif
if(is_known_receiver && strobes > MAX_PHASE_STROBES) { /* if(is_known_receiver && strobes > MAX_PHASE_STROBES) {
break; break;
} }*/
len = 0; len = 0;