esp8266: Let RTC work correctly after deepsleep.

By design, at wake up from deepsleep, the RTC timer will be reset, but
the data stored in RTC memory will not [1]. Therefore, we have to adjust
delta in RTC memory before going into deepsleep to get almost correct
time after waking up.

[1] http://bbs.espressif.com/viewtopic.php?t=1184#p4082
This commit is contained in:
puuu
2016-06-04 00:21:26 +09:00
committed by Damien George
parent eb78a5c530
commit ee12581a35
4 changed files with 15 additions and 1 deletions

View File

@@ -103,6 +103,8 @@ STATIC mp_obj_t machine_deepsleep(void) {
}
}
// prepare for RTC reset at wake up
rtc_prepare_deepsleep(sleep_us);
// put the device in a deep-sleep state
system_deep_sleep_set_option(0); // default power down mode; TODO check this
system_deep_sleep(sleep_us);