diff options
author | puuu <puuu@users.noreply.github.com> | 2016-06-04 00:21:26 +0900 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2016-06-06 10:51:12 +0100 |
commit | ee12581a3545c6e950b4a2b5322167eb73326928 (patch) | |
tree | 609ae347a303629663d3c7196e2be3b2643bc72e /esp8266/modmachine.c | |
parent | eb78a5c530e21b5ce6bae8d7c28c1508275c7f68 (diff) | |
download | micropython-ee12581a3545c6e950b4a2b5322167eb73326928.tar.gz micropython-ee12581a3545c6e950b4a2b5322167eb73326928.zip |
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
Diffstat (limited to 'esp8266/modmachine.c')
-rw-r--r-- | esp8266/modmachine.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/esp8266/modmachine.c b/esp8266/modmachine.c index 36872c9dff..80ae7ac2a0 100644 --- a/esp8266/modmachine.c +++ b/esp8266/modmachine.c @@ -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); |