diff --git a/code/espurna/rpnrules.cpp b/code/espurna/rpnrules.cpp index 68790936..dc4bc182 100644 --- a/code/espurna/rpnrules.cpp +++ b/code/espurna/rpnrules.cpp @@ -689,6 +689,7 @@ void _rpnInit() { rpn_operator_set(_rpn_ctxt, "disconnect", 0, [](rpn_context & ctxt) -> rpn_error { wifiDisconnect(); + yield(); return 0; }); diff --git a/code/espurna/ws.cpp b/code/espurna/ws.cpp index dee0ac05..ac4fc6f4 100644 --- a/code/espurna/ws.cpp +++ b/code/espurna/ws.cpp @@ -21,7 +21,6 @@ Copyright (C) 2016-2019 by Xose PĂ©rez #include "libs/WebSocketIncommingBuffer.h" AsyncWebSocket _ws("/ws"); -Ticker _ws_defer; // ----------------------------------------------------------------------------- // Periodic updates @@ -344,7 +343,11 @@ void _wsParse(AsyncWebSocketClient *client, uint8_t * payload, size_t length) { } if (strcmp(action, "reconnect") == 0) { - _ws_defer.once_ms(100, wifiDisconnect); + static Ticker timer; + timer.once_ms_scheduled(100, []() { + wifiDisconnect(); + yield(); + }); return; }