Commit 87fa57ed authored by Eric Duminil's avatar Eric Duminil
Browse files

Pointer. possibly not needed

parent b5fddd0f
...@@ -60,20 +60,25 @@ namespace web_server { ...@@ -60,20 +60,25 @@ namespace web_server {
DNSServer dnsServer; DNSServer dnsServer;
IotWebConf iotWebConf(ampel.sensorId, &dnsServer, &http, HTTP_PASSWORD); IotWebConf *iotWebConf;
void update() { void update() {
iotWebConf.doLoop(); iotWebConf->doLoop();
// http.handleClient(); // Listen for HTTP requests from clients // http.handleClient(); // Listen for HTTP requests from clients
} }
void initialize() { void initialize() {
iotWebConf.init();
Serial.print("HELLO : ");
Serial.println(ampel.sensorId);
iotWebConf = new IotWebConf(ampel.sensorId, &dnsServer, &http, HTTP_PASSWORD);
iotWebConf->init();
sensor_console::defineCommand("reset_config", []() { sensor_console::defineCommand("reset_config", []() {
Serial.print("Resetting config..."); Serial.print("Resetting config...");
iotWebConf.getSystemParameterGroup()->applyDefaultValue(); iotWebConf->getSystemParameterGroup()->applyDefaultValue();
iotWebConf.saveConfig(); iotWebConf->saveConfig();
Serial.println("Done!"); Serial.println("Done!");
}, F("(resets the complete IotWeb config)")); }, F("(resets the complete IotWeb config)"));
...@@ -222,10 +227,10 @@ namespace web_server { ...@@ -222,10 +227,10 @@ namespace web_server {
#endif #endif
http.on("/config", [] { http.on("/config", [] {
iotWebConf.handleConfig(); iotWebConf->handleConfig();
}); });
http.onNotFound([]() { http.onNotFound([]() {
iotWebConf.handleNotFound(); iotWebConf->handleNotFound();
}); });
// http.begin(); // http.begin();
...@@ -244,7 +249,7 @@ namespace web_server { ...@@ -244,7 +249,7 @@ namespace web_server {
void handleWebServerRoot() { void handleWebServerRoot() {
// -- Let IotWebConf test and handle captive portal requests. // -- Let IotWebConf test and handle captive portal requests.
if (iotWebConf.handleCaptivePortal()) { if (iotWebConf->handleCaptivePortal()) {
// -- Captive portal request were already served. // -- Captive portal request were already served.
return; return;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment