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 doHousekeeping(void);
|
||||
uint64_t uptime(void);
|
||||
void reset_counters(void);
|
||||
uint32_t getFreeRAM();
|
||||
|
||||
|
@ -12,7 +12,6 @@
|
||||
void do_reset(bool warmstart);
|
||||
void do_after_reset(void);
|
||||
void enter_deepsleep(const uint64_t wakeup_sec, const gpio_num_t wakeup_gpio);
|
||||
|
||||
extern RTC_DATA_ATTR unsigned long RTC_millis;
|
||||
uint64_t uptime(void);
|
||||
|
||||
#endif // _RESET_H
|
@ -134,8 +134,6 @@ void doHousekeeping() {
|
||||
|
||||
} // doHousekeeping()
|
||||
|
||||
uint64_t uptime() { return (RTC_millis + millis()); }
|
||||
|
||||
uint32_t getFreeRAM() {
|
||||
#ifndef BOARD_HAS_PSRAM
|
||||
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.
|
||||
gettimeofday(&RTC_sleep_start_time, NULL);
|
||||
RTC_millis = millis();
|
||||
RTC_millis += millis();
|
||||
ESP_LOGI(TAG, "Going to sleep, good bye.");
|
||||
esp_deep_sleep_start();
|
||||
|
||||
Error:
|
||||
ESP_LOGE(TAG, "Can't go to sleep. Resetting.");
|
||||
do_reset(true);
|
||||
}
|
||||
}
|
||||
|
||||
uint64_t uptime() { return (RTC_millis + millis()); }
|
Loading…
Reference in New Issue
Block a user