Explorar o código

reload settings object after restoring settings file

Christopher Mullins %!s(int64=8) %!d(string=hai) anos
pai
achega
57d1360ad0
Modificáronse 1 ficheiros con 7 adicións e 1 borrados
  1. 7 1
      lib/WebServer/MiLightHttpServer.cpp

+ 7 - 1
lib/WebServer/MiLightHttpServer.cpp

@@ -14,7 +14,13 @@ void MiLightHttpServer::begin() {
   server.on("/", HTTP_GET, handleServe_P(index_html_gz, index_html_gz_len));
   server.on("/settings", HTTP_GET, [this]() { serveSettings(); });
   server.on("/settings", HTTP_PUT, [this]() { handleUpdateSettings(); });
-  server.on("/settings", HTTP_POST, [this]() { server.send_P(200, TEXT_PLAIN, PSTR("success.")); }, handleUpdateFile(SETTINGS_FILE));
+  server.on("/settings", HTTP_POST,
+    [this]() {
+      Settings::load(settings);
+      server.send_P(200, TEXT_PLAIN, PSTR("success."));
+    },
+    handleUpdateFile(SETTINGS_FILE)
+  );
   server.on("/radio_configs", HTTP_GET, [this]() { handleGetRadioConfigs(); });
 
   server.on("/gateway_traffic", HTTP_GET, [this]() { handleListenGateway(NULL); });