Bugfix: if the cc2420_cca() function wasn't able to turn on the radio properly, it should turn it off again if it was off before.

This commit is contained in:
adamdunkels 2010-12-05 00:14:24 +00:00
parent 35b2ce0cdb
commit 433d42e170

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: cc2420.c,v 1.60 2010/09/23 08:26:06 nifi Exp $ * @(#)$Id: cc2420.c,v 1.61 2010/12/05 00:14:24 adamdunkels Exp $
*/ */
/* /*
* This code is almost device independent and should be easy to port. * This code is almost device independent and should be easy to port.
@ -840,6 +840,9 @@ cc2420_cca(void)
/* Make sure that the radio really got turned on. */ /* Make sure that the radio really got turned on. */
if(!receive_on) { if(!receive_on) {
RELEASE_LOCK(); RELEASE_LOCK();
if(radio_was_off) {
cc2420_off();
}
return 1; return 1;
} }