Browse Source

RELOAD terminal command forces modules to reload settings from config (#816)

rfm69
Xose Pérez 6 years ago
parent
commit
3518d1013e
2 changed files with 15 additions and 3 deletions
  1. +5
    -0
      code/espurna/settings.ino
  2. +10
    -3
      code/espurna/ws.ino

+ 5
- 0
code/espurna/settings.ino View File

@ -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);


+ 10
- 3
code/espurna/ws.ino View File

@ -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();


Loading…
Cancel
Save