diff --git a/code/espurna/settings.ino b/code/espurna/settings.ino index ce98370a..9d5767b3 100644 --- a/code/espurna/settings.ino +++ b/code/espurna/settings.ino @@ -269,6 +269,11 @@ void _settingsInitCommands() { DEBUG_MSG_P(PSTR("+OK\n")); }); + settingsRegisterCommand(F("RELOAD"), [](Embedis* e) { + wsReload(); + DEBUG_MSG_P(PSTR("+OK\n")); + }); + settingsRegisterCommand(F("RESET"), [](Embedis* e) { DEBUG_MSG_P(PSTR("+OK\n")); deferredReset(100, CUSTOM_RESET_TERMINAL); diff --git a/code/espurna/ws.ino b/code/espurna/ws.ino index 265172f3..68a18ba2 100644 --- a/code/espurna/ws.ino +++ b/code/espurna/ws.ino @@ -205,9 +205,7 @@ void _wsParse(AsyncWebSocketClient *client, uint8_t * payload, size_t length) { if (save) { // Callbacks - for (unsigned char i = 0; i < _ws_on_after_parse_callbacks.size(); i++) { - (_ws_on_after_parse_callbacks[i])(); - } + wsReload(); // This should got to callback as well // but first change management has to be in place @@ -434,6 +432,15 @@ void wsConfigure() { #endif } +// This method being public makes +// _ws_on_after_parse_callbacks strange here, +// it should belong somewhere else. +void wsReload() { + for (unsigned char i = 0; i < _ws_on_after_parse_callbacks.size(); i++) { + (_ws_on_after_parse_callbacks[i])(); + } +} + void wsSetup() { _ws.onEvent(_wsEvent); wsConfigure();