diff --git a/include/cyclic.h b/include/cyclic.h index 6bd9b2a7..8c7319be 100644 --- a/include/cyclic.h +++ b/include/cyclic.h @@ -15,7 +15,6 @@ extern Ticker cyclicTimer; void setCyclicIRQ(void); void doHousekeeping(void); -uint64_t uptime(void); void reset_counters(void); uint32_t getFreeRAM(); diff --git a/include/reset.h b/include/reset.h index f540ff62..0ce84c78 100644 --- a/include/reset.h +++ b/include/reset.h @@ -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 \ No newline at end of file diff --git a/src/cyclic.cpp b/src/cyclic.cpp index b6dd1120..a927a21e 100644 --- a/src/cyclic.cpp +++ b/src/cyclic.cpp @@ -134,8 +134,6 @@ void doHousekeeping() { } // doHousekeeping() -uint64_t uptime() { return (RTC_millis + millis()); } - uint32_t getFreeRAM() { #ifndef BOARD_HAS_PSRAM return ESP.getFreeHeap(); diff --git a/src/reset.cpp b/src/reset.cpp index ade00195..addeb36f 100644 --- a/src/reset.cpp +++ b/src/reset.cpp @@ -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); -} \ No newline at end of file +} + +uint64_t uptime() { return (RTC_millis + millis()); } \ No newline at end of file