bugfix persist uptime after deep sleep
This commit is contained in:
parent
85529920d5
commit
fdfd10b227
@ -15,7 +15,6 @@ extern Ticker cyclicTimer;
|
|||||||
|
|
||||||
void setCyclicIRQ(void);
|
void setCyclicIRQ(void);
|
||||||
void doHousekeeping(void);
|
void doHousekeeping(void);
|
||||||
uint64_t uptime(void);
|
|
||||||
void reset_counters(void);
|
void reset_counters(void);
|
||||||
uint32_t getFreeRAM();
|
uint32_t getFreeRAM();
|
||||||
|
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
void do_reset(bool warmstart);
|
void do_reset(bool warmstart);
|
||||||
void do_after_reset(void);
|
void do_after_reset(void);
|
||||||
void enter_deepsleep(const uint64_t wakeup_sec, const gpio_num_t wakeup_gpio);
|
void enter_deepsleep(const uint64_t wakeup_sec, const gpio_num_t wakeup_gpio);
|
||||||
|
uint64_t uptime(void);
|
||||||
extern RTC_DATA_ATTR unsigned long RTC_millis;
|
|
||||||
|
|
||||||
#endif // _RESET_H
|
#endif // _RESET_H
|
@ -134,8 +134,6 @@ void doHousekeeping() {
|
|||||||
|
|
||||||
} // doHousekeeping()
|
} // doHousekeeping()
|
||||||
|
|
||||||
uint64_t uptime() { return (RTC_millis + millis()); }
|
|
||||||
|
|
||||||
uint32_t getFreeRAM() {
|
uint32_t getFreeRAM() {
|
||||||
#ifndef BOARD_HAS_PSRAM
|
#ifndef BOARD_HAS_PSRAM
|
||||||
return ESP.getFreeHeap();
|
return ESP.getFreeHeap();
|
||||||
|
@ -183,11 +183,13 @@ void enter_deepsleep(const uint64_t wakeup_sec = 60,
|
|||||||
|
|
||||||
// time stamp sleep start time and save system monotonic time. Deep sleep.
|
// time stamp sleep start time and save system monotonic time. Deep sleep.
|
||||||
gettimeofday(&RTC_sleep_start_time, NULL);
|
gettimeofday(&RTC_sleep_start_time, NULL);
|
||||||
RTC_millis = millis();
|
RTC_millis += millis();
|
||||||
ESP_LOGI(TAG, "Going to sleep, good bye.");
|
ESP_LOGI(TAG, "Going to sleep, good bye.");
|
||||||
esp_deep_sleep_start();
|
esp_deep_sleep_start();
|
||||||
|
|
||||||
Error:
|
Error:
|
||||||
ESP_LOGE(TAG, "Can't go to sleep. Resetting.");
|
ESP_LOGE(TAG, "Can't go to sleep. Resetting.");
|
||||||
do_reset(true);
|
do_reset(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint64_t uptime() { return (RTC_millis + millis()); }
|
Loading…
Reference in New Issue
Block a user