Browse Source

wifi: yield after disconnecting

mcspr-patch-1
Maxim Prokhorov 4 years ago
parent
commit
29caf0036d
2 changed files with 6 additions and 2 deletions
  1. +1
    -0
      code/espurna/rpnrules.cpp
  2. +5
    -2
      code/espurna/ws.cpp

+ 1
- 0
code/espurna/rpnrules.cpp View File

@ -689,6 +689,7 @@ void _rpnInit() {
rpn_operator_set(_rpn_ctxt, "disconnect", 0, [](rpn_context & ctxt) -> rpn_error {
wifiDisconnect();
yield();
return 0;
});


+ 5
- 2
code/espurna/ws.cpp View File

@ -21,7 +21,6 @@ Copyright (C) 2016-2019 by Xose Pérez <xose dot perez at gmail dot com>
#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;
}


Loading…
Cancel
Save