sleep for a very long time, because the lorawan32 board doesn't have an off switch

This commit is contained in:
geeksville
2020-02-01 19:09:17 -08:00
parent 2474b3b064
commit 02ed249374
4 changed files with 19 additions and 18 deletions

View File

@@ -60,6 +60,9 @@ void doDeepSleep(uint64_t msecToWake)
// FIXME, shutdown radiohead interrupts before powering off device
// Put radio in sleep mode (will still draw power but only 0.2uA)
radio.sleep();
#ifdef T_BEAM_V10
if (axp192_found)
{
@@ -316,7 +319,7 @@ void loop()
#ifdef LED_PIN
// toggle the led so we can get some rough sense of how often loop is pausing
digitalWrite(LED_PIN, digitalRead(LED_PIN) ? 0 : 1);
#endif
#endif
#ifdef BUTTON_PIN
// if user presses button for more than 3 secs, discard our network prefs and reboot (FIXME, use a debounce lib instead of this boilerplate)
@@ -345,19 +348,14 @@ void loop()
}
#endif
// Send every SEND_INTERVAL millis
static uint32_t last = 0;
if (true)
{
#ifdef MINWAKE_MSECS
if (millis() > MINWAKE_MSECS)
{
sleep();
}
if (millis() > MINWAKE_MSECS)
{
sleep();
}
#endif
// No GPS lock yet, let the OS put the main CPU in low power mode for 100ms (or until another interrupt comes in)
// i.e. don't just keep spinning in loop as fast as we can.
delay(100);
}
// No GPS lock yet, let the OS put the main CPU in low power mode for 100ms (or until another interrupt comes in)
// i.e. don't just keep spinning in loop as fast as we can.
delay(100);
}