From 788095c66e220c6fe2e88b5205845c851502e475 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Thu, 25 Jun 2015 00:13:06 +0300 Subject: [PATCH] Remove implementations of WDT-related functions which were not correct since 0.9.3 anyway --- README.md | 4 +--- cores/esp8266/Esp.cpp | 28 +++++++++------------------- cores/esp8266/Esp.h | 2 -- 3 files changed, 10 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index a0b9f4c0e..69027a64f 100644 --- a/README.md +++ b/README.md @@ -153,9 +153,7 @@ APIs related to deep sleep and watchdog timer are available in the ```ESP``` obj ```ESP.deepSleep(microseconds, mode)``` will put the chip into deep sleep. ```mode``` is one of ```WAKE_RF_DEFAULT```, ```WAKE_RFCAL```, ```WAKE_NO_RFCAL```, ```WAKE_RF_DISABLED```. (GPIO16 needs to be tied to RST to wake from deepSleep.) -```ESP.wdtEnable()```, ```ESP.wdtDisable()```, and ```ESP.wdtFeed()``` provide some control over the watchdog timer. - -```ESP.reset()``` resets the CPU. +```ESP.restart()``` restarts the CPU. ```ESP.getFreeHeap()``` returns the free heap size. diff --git a/cores/esp8266/Esp.cpp b/cores/esp8266/Esp.cpp index 73367683a..617dd9cba 100644 --- a/cores/esp8266/Esp.cpp +++ b/cores/esp8266/Esp.cpp @@ -32,12 +32,6 @@ extern struct rst_info resetInfo; // #define DEBUG_SERIAL Serial -//extern "C" void ets_wdt_init(uint32_t val); -extern "C" void ets_wdt_enable(void); -extern "C" void ets_wdt_disable(void); -extern "C" void wdt_feed(void) { - -} /** * User-defined Literals @@ -85,46 +79,42 @@ unsigned long long operator"" _GB(unsigned long long x) { EspClass ESP; -EspClass::EspClass() -{ - -} - void EspClass::wdtEnable(uint32_t timeout_ms) { - //todo find doku for ets_wdt_init may set the timeout - ets_wdt_enable(); } void EspClass::wdtEnable(WDTO_t timeout_ms) { - wdtEnable((uint32_t) timeout_ms); } void EspClass::wdtDisable(void) { - ets_wdt_disable(); } void EspClass::wdtFeed(void) { - wdt_feed(); } void EspClass::deepSleep(uint32_t time_us, WakeMode mode) { - system_deep_sleep_set_option(static_cast(mode)); - system_deep_sleep(time_us); + system_deep_sleep_set_option(static_cast(mode)); + system_deep_sleep(time_us); } +extern "C" void esp_yield(); +extern "C" void __real_system_restart_local(); void EspClass::reset(void) { - ((void (*)(void))0x40000080)(); + __real_system_restart_local(); } void EspClass::restart(void) { system_restart(); + esp_yield(); + // todo: provide an alternative code path if this was called + // from system context, not from continuation + // (implement esp_is_cont_ctx()?) } uint16_t EspClass::getVcc(void) diff --git a/cores/esp8266/Esp.h b/cores/esp8266/Esp.h index d264690a9..e55cd281a 100644 --- a/cores/esp8266/Esp.h +++ b/cores/esp8266/Esp.h @@ -71,8 +71,6 @@ typedef enum { class EspClass { public: - EspClass(); - // TODO: figure out how to set WDT timeout void wdtEnable(uint32_t timeout_ms = 0); // note: setting the timeout value is not implemented at the moment