mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-19 23:22:16 +03:00
Return to scheduler context from ESP::deepSleep (#609)
This commit is contained in:
parent
e02932fcdd
commit
cc152de907
@ -92,7 +92,7 @@ void EspClass::wdtEnable(WDTO_t timeout_ms)
|
||||
|
||||
void EspClass::wdtDisable(void)
|
||||
{
|
||||
/// Please don’t stop software watchdog too long (less than 6 seconds),
|
||||
/// Please don't stop software watchdog too long (less than 6 seconds),
|
||||
/// otherwise it will trigger hardware watchdog reset.
|
||||
system_soft_wdt_stop();
|
||||
}
|
||||
@ -102,13 +102,15 @@ void EspClass::wdtFeed(void)
|
||||
|
||||
}
|
||||
|
||||
extern "C" void esp_yield();
|
||||
|
||||
void EspClass::deepSleep(uint32_t time_us, WakeMode mode)
|
||||
{
|
||||
system_deep_sleep_set_option(static_cast<int>(mode));
|
||||
system_deep_sleep(time_us);
|
||||
system_deep_sleep_set_option(static_cast<int>(mode));
|
||||
system_deep_sleep(time_us);
|
||||
esp_yield();
|
||||
}
|
||||
|
||||
extern "C" void esp_yield();
|
||||
extern "C" void __real_system_restart_local();
|
||||
void EspClass::reset(void)
|
||||
{
|
||||
@ -119,9 +121,6 @@ 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)
|
||||
@ -399,4 +398,3 @@ bool EspClass::updateSketch(Stream& in, uint32_t size, bool restartOnFail, bool
|
||||
if(restartOnSuccess) ESP.restart();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,9 @@ extern "C" void abort() {
|
||||
}
|
||||
|
||||
extern "C" void esp_yield() {
|
||||
cont_yield(&g_cont);
|
||||
if (cont_can_yield(&g_cont)) {
|
||||
cont_yield(&g_cont);
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" void esp_schedule() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user