fix sleep mode oddities
This commit is contained in:
1 parent
73c02dea56
commit
fa1d29c627
7 files changed
+8
-9
No files matched your search
+2
-2
@@ -76,9 +76,9 @@ void irqHandler(void *pvParameters) {
|
||||
// goto sleep if we have a sleep cycle
|
||||
if (cfg.sleepcycle)
|
||||
#ifdef HAS_BUTTON
|
||||
enter_deepsleep(cfg.sleepcycle * 10, (gpio_num_t)HAS_BUTTON);
|
||||
enter_deepsleep(cfg.sleepcycle * 10UL, (gpio_num_t)HAS_BUTTON);
|
||||
#else
|
||||
enter_deepsleep(cfg.sleepcycle * 10);
|
||||
enter_deepsleep(cfg.sleepcycle * 10UL, GPIO_NUM_MAX);
|
||||
#endif
|
||||
}
|
||||
} // for
|
||||
|
||||
+1
-1
@@ -501,7 +501,7 @@ bool ttn_rtc_restore() {
|
||||
// following code includes snippets taken from
|
||||
// https://github.com/JackGruber/ESP32-LMIC-DeepSleep-example/blob/master/src/main.cpp
|
||||
|
||||
void SaveLMICToRTC(int deepsleep_sec) {
|
||||
void SaveLMICToRTC(uint32_t deepsleep_sec) {
|
||||
// ESP32 can't track millis during DeepSleep and no option to advance
|
||||
// millis after DeepSleep. Therefore reset DutyCyles before saving LMIC struct
|
||||
|
||||
|
||||
+1
-1
@@ -57,7 +57,7 @@ void AXP192_powerevent_IRQ(void) {
|
||||
#ifdef HAS_BUTTON
|
||||
// short press -> esp32 deep sleep mode, must be exited by user button
|
||||
if (pmu.isPekeyShortPressIrq())
|
||||
enter_deepsleep(0, HAS_BUTTON);
|
||||
enter_deepsleep(0UL, HAS_BUTTON);
|
||||
#endif
|
||||
|
||||
pmu.clearIrqStatus();
|
||||
|
||||
+1
-1
@@ -84,7 +84,7 @@ void do_after_reset(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void enter_deepsleep(const uint64_t wakeup_sec, gpio_num_t wakeup_gpio) {
|
||||
void enter_deepsleep(const uint32_t wakeup_sec, gpio_num_t wakeup_gpio) {
|
||||
ESP_LOGI(TAG, "Preparing to sleep...");
|
||||
|
||||
RTC_runmode = RUNMODE_SLEEP;
|
||||
|
||||
Reference in new issue
Block a user