esp32: Fix not the right time spent in a deep sleep
Before entering the deep sleep, the RTC and FRC counters are synchronized. Updating the boot_time. Added a unit test for this case. Fixed warnings for MULTIPLE_STAGES Closes https://github.com/espressif/esp-idf/issues/1840
This commit is contained in:
@@ -371,3 +371,11 @@ uint64_t system_get_rtc_time(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
void esp_sync_counters_rtc_and_frc()
|
||||
{
|
||||
#if defined( WITH_FRC ) && defined( WITH_RTC )
|
||||
adjtime_corr_stop();
|
||||
int64_t s_microseconds_offset_cur = get_rtc_time_us() - esp_timer_get_time();
|
||||
set_boot_time(get_adjusted_boot_time() + ((int64_t)s_microseconds_offset - s_microseconds_offset_cur));
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user