Skip to content

Commit 145b736

Browse files
committed
Remove implementations of WDT-related functions
which were not correct since 0.9.3 anyway
1 parent f1fa4c5 commit 145b736

File tree

3 files changed

+10
-24
lines changed

3 files changed

+10
-24
lines changed

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,7 @@ APIs related to deep sleep and watchdog timer are available in the ```ESP``` obj
153153

154154
```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.)
155155

156-
```ESP.wdtEnable()```, ```ESP.wdtDisable()```, and ```ESP.wdtFeed()``` provide some control over the watchdog timer.
157-
158-
```ESP.reset()``` resets the CPU.
156+
```ESP.restart()``` restarts the CPU.
159157

160158
```ESP.getFreeHeap()``` returns the free heap size.
161159

hardware/esp8266com/esp8266/cores/esp8266/Esp.cpp

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,6 @@ extern struct rst_info resetInfo;
3232

3333
// #define DEBUG_SERIAL Serial
3434

35-
//extern "C" void ets_wdt_init(uint32_t val);
36-
extern "C" void ets_wdt_enable(void);
37-
extern "C" void ets_wdt_disable(void);
38-
extern "C" void wdt_feed(void) {
39-
40-
}
4135

4236
/**
4337
* User-defined Literals
@@ -85,46 +79,42 @@ unsigned long long operator"" _GB(unsigned long long x) {
8579

8680
EspClass ESP;
8781

88-
EspClass::EspClass()
89-
{
90-
91-
}
92-
9382
void EspClass::wdtEnable(uint32_t timeout_ms)
9483
{
95-
//todo find doku for ets_wdt_init may set the timeout
96-
ets_wdt_enable();
9784
}
9885

9986
void EspClass::wdtEnable(WDTO_t timeout_ms)
10087
{
101-
wdtEnable((uint32_t) timeout_ms);
10288
}
10389

10490
void EspClass::wdtDisable(void)
10591
{
106-
ets_wdt_disable();
10792
}
10893

10994
void EspClass::wdtFeed(void)
11095
{
111-
wdt_feed();
11296
}
11397

11498
void EspClass::deepSleep(uint32_t time_us, WakeMode mode)
11599
{
116-
system_deep_sleep_set_option(static_cast<int>(mode));
117-
system_deep_sleep(time_us);
100+
system_deep_sleep_set_option(static_cast<int>(mode));
101+
system_deep_sleep(time_us);
118102
}
119103

104+
extern "C" void esp_yield();
105+
extern "C" void __real_system_restart_local();
120106
void EspClass::reset(void)
121107
{
122-
((void (*)(void))0x40000080)();
108+
__real_system_restart_local();
123109
}
124110

125111
void EspClass::restart(void)
126112
{
127113
system_restart();
114+
esp_yield();
115+
// todo: provide an alternative code path if this was called
116+
// from system context, not from continuation
117+
// (implement esp_is_cont_ctx()?)
128118
}
129119

130120
uint16_t EspClass::getVcc(void)

hardware/esp8266com/esp8266/cores/esp8266/Esp.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,6 @@ typedef enum {
7171

7272
class EspClass {
7373
public:
74-
EspClass();
75-
7674
// TODO: figure out how to set WDT timeout
7775
void wdtEnable(uint32_t timeout_ms = 0);
7876
// note: setting the timeout value is not implemented at the moment

0 commit comments

Comments
 (0)