bugfix persist uptime after deep sleep

This commit is contained in:
cyberman54 2020-12-19 22:30:34 +01:00
parent 85529920d5
commit fdfd10b227
4 changed files with 5 additions and 7 deletions

View File

@ -15,7 +15,6 @@ extern Ticker cyclicTimer;
void setCyclicIRQ(void);
void doHousekeeping(void);
uint64_t uptime(void);
void reset_counters(void);
uint32_t getFreeRAM();

View File

@ -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

View File

@ -134,8 +134,6 @@ void doHousekeeping() {
} // doHousekeeping()
uint64_t uptime() { return (RTC_millis + millis()); }
uint32_t getFreeRAM() {
#ifndef BOARD_HAS_PSRAM
return ESP.getFreeHeap();

View File

@ -183,7 +183,7 @@ 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();
@ -191,3 +191,5 @@ Error:
ESP_LOGE(TAG, "Can't go to sleep. Resetting.");
do_reset(true);
}
uint64_t uptime() { return (RTC_millis + millis()); }