Fix problem with sleeptime reported by @marceltrapman.
This commit is contained in:
@@ -472,7 +472,7 @@ void wakeUp() //place to send the interrupts
|
|||||||
continueTimer = false;
|
continueTimer = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MySensor::internalSleep(int ms) {
|
void MySensor::internalSleep(unsigned long ms) {
|
||||||
while (continueTimer && ms >= 8000) { LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF); ms -= 8000; }
|
while (continueTimer && ms >= 8000) { LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF); ms -= 8000; }
|
||||||
if (continueTimer && ms >= 4000) { LowPower.powerDown(SLEEP_4S, ADC_OFF, BOD_OFF); ms -= 4000; }
|
if (continueTimer && ms >= 4000) { LowPower.powerDown(SLEEP_4S, ADC_OFF, BOD_OFF); ms -= 4000; }
|
||||||
if (continueTimer && ms >= 2000) { LowPower.powerDown(SLEEP_2S, ADC_OFF, BOD_OFF); ms -= 2000; }
|
if (continueTimer && ms >= 2000) { LowPower.powerDown(SLEEP_2S, ADC_OFF, BOD_OFF); ms -= 2000; }
|
||||||
@@ -485,7 +485,7 @@ void MySensor::internalSleep(int ms) {
|
|||||||
if (continueTimer && ms >= 16) { LowPower.powerDown(SLEEP_15Ms, ADC_OFF, BOD_OFF); ms -= 15; }
|
if (continueTimer && ms >= 16) { LowPower.powerDown(SLEEP_15Ms, ADC_OFF, BOD_OFF); ms -= 15; }
|
||||||
}
|
}
|
||||||
|
|
||||||
void MySensor::sleep(int ms) {
|
void MySensor::sleep(unsigned long ms) {
|
||||||
// Let serial prints finish (debug, log etc)
|
// Let serial prints finish (debug, log etc)
|
||||||
Serial.flush();
|
Serial.flush();
|
||||||
RF24::powerDown();
|
RF24::powerDown();
|
||||||
@@ -493,7 +493,7 @@ void MySensor::sleep(int ms) {
|
|||||||
internalSleep(ms);
|
internalSleep(ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MySensor::sleep(int interrupt, int mode, int ms) {
|
bool MySensor::sleep(int interrupt, int mode, unsigned long ms) {
|
||||||
// Let serial prints finish (debug, log etc)
|
// Let serial prints finish (debug, log etc)
|
||||||
bool pinTriggeredWakeup = true;
|
bool pinTriggeredWakeup = true;
|
||||||
Serial.flush();
|
Serial.flush();
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ class MySensor : public RF24
|
|||||||
* Sleep (PowerDownMode) the Arduino and radio. Wake up on timer.
|
* Sleep (PowerDownMode) the Arduino and radio. Wake up on timer.
|
||||||
* @param ms Number of milliseconds to sleep.
|
* @param ms Number of milliseconds to sleep.
|
||||||
*/
|
*/
|
||||||
void sleep(int ms);
|
void sleep(unsigned long ms);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sleep (PowerDownMode) the Arduino and radio. Wake up on timer or pin change.
|
* Sleep (PowerDownMode) the Arduino and radio. Wake up on timer or pin change.
|
||||||
@@ -214,7 +214,7 @@ class MySensor : public RF24
|
|||||||
* @param ms Number of milliseconds to sleep or 0 to sleep forever
|
* @param ms Number of milliseconds to sleep or 0 to sleep forever
|
||||||
* @return true if wake up was triggered by pin change and false means timer woke it up.
|
* @return true if wake up was triggered by pin change and false means timer woke it up.
|
||||||
*/
|
*/
|
||||||
bool sleep(int interrupt, int mode, int ms=0);
|
bool sleep(int interrupt, int mode, unsigned long ms=0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* getInternalTemp
|
* getInternalTemp
|
||||||
@@ -264,7 +264,7 @@ class MySensor : public RF24
|
|||||||
uint8_t getChildRoute(uint8_t childId);
|
uint8_t getChildRoute(uint8_t childId);
|
||||||
void addChildRoute(uint8_t childId, uint8_t route);
|
void addChildRoute(uint8_t childId, uint8_t route);
|
||||||
void removeChildRoute(uint8_t childId);
|
void removeChildRoute(uint8_t childId);
|
||||||
void internalSleep(int ms);
|
void internalSleep(unsigned long ms);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user