From ac459eb148593330a3b0656a2c97e2fde1ae10ac Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Wed, 5 Aug 2015 08:39:34 -0400 Subject: [PATCH] Only erase RTC RAM if sleep mode doesn't look valid (#619) Source: http://esp8266.ru/forum/threads/mem-check-fail.168/#post-7354 --- hardware/esp8266com/esp8266/cores/esp8266/core_esp8266_phy.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hardware/esp8266com/esp8266/cores/esp8266/core_esp8266_phy.c b/hardware/esp8266com/esp8266/cores/esp8266/core_esp8266_phy.c index a4a189384c..ea0beefb1c 100644 --- a/hardware/esp8266com/esp8266/cores/esp8266/core_esp8266_phy.c +++ b/hardware/esp8266com/esp8266/cores/esp8266/core_esp8266_phy.c @@ -261,7 +261,10 @@ void user_rf_pre_init() { // *((volatile uint32_t*) 0x60000710) = 0; volatile uint32_t* rtc_reg = (volatile uint32_t*) 0x60001000; - rtc_reg[30] = 0; + if((rtc_reg[24] >> 16) > 4) { + rtc_reg[24] &= 0xFFFF; + rtc_reg[30] = 0; + } system_set_os_print(0); __run_user_rf_pre_init();