Avoid turning off the radio in the middle of a packet reception

This commit is contained in:
adamdunkels 2010-04-30 07:32:39 +00:00
parent e606c674c2
commit 0859d4b95f

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: xmac.c,v 1.55 2010/03/01 13:30:23 nifi Exp $ * $Id: xmac.c,v 1.56 2010/04/30 07:32:39 adamdunkels Exp $
*/ */
/** /**
@ -61,7 +61,7 @@
#include <string.h> #include <string.h>
#ifndef WITH_ACK_OPTIMIZATION #ifndef WITH_ACK_OPTIMIZATION
#define WITH_ACK_OPTIMIZATION 1 #define WITH_ACK_OPTIMIZATION 0
#endif #endif
#ifndef WITH_ENCOUNTER_OPTIMIZATION #ifndef WITH_ENCOUNTER_OPTIMIZATION
#define WITH_ENCOUNTER_OPTIMIZATION 1 #define WITH_ENCOUNTER_OPTIMIZATION 1
@ -298,7 +298,7 @@ powercycle(struct rtimer *t, void *ptr)
schedule_powercycle(t, xmac_config.on_time); schedule_powercycle(t, xmac_config.on_time);
PT_YIELD(&pt); PT_YIELD(&pt);
if(xmac_config.off_time > 0) { if(xmac_config.off_time > 0 && !NETSTACK_RADIO.receiving_packet()) {
powercycle_turn_radio_off(); powercycle_turn_radio_off();
if(waiting_for_packet != 0) { if(waiting_for_packet != 0) {
waiting_for_packet++; waiting_for_packet++;