Skip to content

Commit

Permalink
Made sure sleep mode is not defined if using ESP8266.
Browse files Browse the repository at this point in the history
  • Loading branch information
Avamander authored Jan 21, 2017
2 parents 8cb283c + 415fdc9 commit be94ea2
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions RF24Network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@
#include "RF24Network.h"
#endif

#if defined (ENABLE_SLEEP_MODE) && !defined (RF24_LINUX) && !defined (__ARDUINO_X86__)
#if defined(ENABLE_SLEEP_MODE) && defined(ESP8266)
#warning "Disabling sleep mode because sleep doesn't work on ESP8266"
#undef ENABLE_SLEEP_MODE
#endif

#if defined (ENABLE_SLEEP_MODE) && !defined (RF24_LINUX) && !defined (__ARDUINO_X86__)
#include <avr/sleep.h>
#include <avr/power.h>
volatile byte sleep_cycles_remaining;
Expand Down Expand Up @@ -1295,8 +1300,6 @@ ISR(WDT_vect){


bool RF24Network::sleepNode( unsigned int cycles, int interruptPin, uint8_t INTERRUPT_MODE){


sleep_cycles_remaining = cycles;
set_sleep_mode(SLEEP_MODE_PWR_DOWN); // sleep mode is set here
sleep_enable();
Expand Down Expand Up @@ -1327,7 +1330,6 @@ bool RF24Network::sleepNode( unsigned int cycles, int interruptPin, uint8_t INTE
#else
WDTCSR &= ~_BV(WDIE);
#endif

return !wasInterrupted;
}

Expand Down

0 comments on commit be94ea2

Please sign in to comment.