|
@@ -13,9 +13,7 @@ namespace mainunit { |
|
|
namespace details {
|
|
|
namespace details {
|
|
|
|
|
|
|
|
|
void prepareSleep() {
|
|
|
void prepareSleep() {
|
|
|
hardware::sim808::powerOff(); //forcing power off, regardless of the counts and current use
|
|
|
|
|
|
hardware::sim808::simSerial.end(); //avoid woke up by SoftwareSerial interrupt
|
|
|
hardware::sim808::simSerial.end(); //avoid woke up by SoftwareSerial interrupt
|
|
|
|
|
|
|
|
|
delay(5); //ensure log messages have been printed out
|
|
|
delay(5); //ensure log messages have been printed out
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
@@ -47,8 +45,8 @@ namespace mainunit { |
|
|
#define CURRENT_LOGGER_FUNCTION "deepSleep"
|
|
|
#define CURRENT_LOGGER_FUNCTION "deepSleep"
|
|
|
NOTICE_FORMAT("%ds", seconds);
|
|
|
NOTICE_FORMAT("%ds", seconds);
|
|
|
|
|
|
|
|
|
details::prepareSleep();
|
|
|
|
|
|
interruptIn(seconds);
|
|
|
interruptIn(seconds);
|
|
|
|
|
|
details::prepareSleep();
|
|
|
LowPower.powerDown(SLEEP_FOREVER, ADC_OFF, BOD_OFF);
|
|
|
LowPower.powerDown(SLEEP_FOREVER, ADC_OFF, BOD_OFF);
|
|
|
details::wokeUp();
|
|
|
details::wokeUp();
|
|
|
}
|
|
|
}
|
|
|