diff --git a/ampel-firmware/web_server.cpp b/ampel-firmware/web_server.cpp index 707e8e5d903c6a51165bc6c82c8e2db09087ce20..2b661271c55f5bcc99b6659befbeb8556508d766 100644 --- a/ampel-firmware/web_server.cpp +++ b/ampel-firmware/web_server.cpp @@ -63,8 +63,7 @@ namespace web_server { IotWebConf *iotWebConf; void update() { - iotWebConf->doLoop(); - // http.handleClient(); // Listen for HTTP requests from clients + iotWebConf->doLoop(); // Listen for HTTP requests from clients } void initialize() { @@ -72,14 +71,19 @@ namespace web_server { Serial.print("HELLO : "); Serial.println(ampel.sensorId); - iotWebConf = new IotWebConf(ampel.sensorId, &dnsServer, &http, HTTP_PASSWORD); + iotWebConf = new IotWebConf(ampel.sensorId, &dnsServer, &http, HTTP_PASSWORD); // So that sensorId is defined. + //TODO: Disable AP if WiFi connects + //TODO: Add callbacks + //TODO: Add LED effects + //TODO: Add other params + //TODO: Use HTTP_USER / HTTP_PASSWORD for config iotWebConf->init(); sensor_console::defineCommand("reset_config", []() { - Serial.print("Resetting config..."); + Serial.println(F("Resetting config...")); iotWebConf->getSystemParameterGroup()->applyDefaultValue(); iotWebConf->saveConfig(); - Serial.println("Done!"); + Serial.println(F("Done!")); }, F("(resets the complete IotWeb config)")); header_template = @@ -103,6 +107,7 @@ namespace web_server { "<div class='pure-g'><div class='pure-u-1'><div class='pure-menu'><p class='pure-menu-heading'>HfT-Stuttgart CO<sub>2</sub> Ampel</p></div></div>\n" "<div class='pure-u-1'><ul class='pure-menu pure-menu-horizontal pure-menu-list'>\n" + "<li class='pure-menu-item'><a href='/config' class='pure-menu-link'>Config</a></li>\n" "<li class='pure-menu-item'><a href='#table' class='pure-menu-link'>Info</a></li>\n" #ifdef AMPEL_CSV "<li class='pure-menu-item'><a href='#graph' class='pure-menu-link'>Graph</a></li>\n" @@ -233,8 +238,7 @@ namespace web_server { iotWebConf->handleNotFound(); }); - // http.begin(); - + //TODO: Only once wifi connected Serial.print(F("You can access this sensor via http://")); Serial.print(ampel.sensorId); Serial.print(F(".local (might be unstable) or http://")); @@ -248,9 +252,8 @@ namespace web_server { } void handleWebServerRoot() { - // -- Let IotWebConf test and handle captive portal requests. if (iotWebConf->handleCaptivePortal()) { - // -- Captive portal request were already served. + // -- Captive portal requests were already served. return; } if (!shouldBeAllowed()) {