diff --git a/ampel-firmware/src/lib/NTPClient/NTPClient.h b/ampel-firmware/src/lib/NTPClient/NTPClient.h index 5df9e7a70acf2947e4a5be2da5cc497850daaa09..9cd0311300db6c5d2667f7a99b98253cce366538 100755 --- a/ampel-firmware/src/lib/NTPClient/NTPClient.h +++ b/ampel-firmware/src/lib/NTPClient/NTPClient.h @@ -20,7 +20,7 @@ class NTPClient { unsigned long _updateInterval = 60000; // In ms - unsigned long _currentEpoc = 1640995200; // NOTE: Custom code for ampel-firmware : Default is 1st January 2020. Better than 1970 + unsigned long _currentEpoc = 0; // In ms unsigned long _lastUpdate = 0; // In ms byte _packetBuffer[NTP_PACKET_SIZE]; diff --git a/ampel-firmware/web_server.cpp b/ampel-firmware/web_server.cpp index d35c4a3393ceb111213d50520ad534c05d5872dd..e51b7c2f4cae67b360491f88fe22bffc61ba5a2d 100644 --- a/ampel-firmware/web_server.cpp +++ b/ampel-firmware/web_server.cpp @@ -29,6 +29,7 @@ namespace web_server { void handleWebServerCSV(); void definePages() { + //TODO: Remove all "\n" to save some space header_template = PSTR("<!doctype html><html lang=en>" "<head>\n" @@ -140,10 +141,13 @@ namespace web_server { "n=lines.length;\n" "lines.forEach((line,i)=>{\n" "fields=line.split(';');\n" + //Don't display points without time + "if (!fields[0].includes('1970-')){" "xs.push(fields[0]);\n" "data[0]['y'].push(fields[1]);\n" "data[1]['y'].push(fields[2]);\n" "data[2]['y'].push(fields[3]);\n" + "};" "if(i>4 && i<n-12){if(i==5){fields=['...','...','...','...']}else{return;}}\n" "row=document.createElement('tr');\n" "fields.forEach((field,index)=>{\n" @@ -171,10 +175,6 @@ namespace web_server { } void handleWebServerRoot() { -// if (web_config::handleCaptivePortal()) { -// // -- Captive portal requests were already served. -// return; -// } if (!shouldBeAllowed()) { return web_config::http.requestAuthentication(DIGEST_AUTH); } @@ -194,8 +194,8 @@ namespace web_server { snprintf_P(content, sizeof(content), header_template, sensor::co2, ampel.sensorId, wifi::local_ip, csv_writer::filename); - // Serial.print(F("INFO - Header size : ")); - // Serial.print(strlen(content)); + Serial.print(F("INFO - Header size : ")); + Serial.print(strlen(content)); web_config::http.setContentLength(CONTENT_LENGTH_UNKNOWN); web_config::http.send_P(200, PSTR("text/html"), content); @@ -212,15 +212,15 @@ namespace web_server { wifi::local_ip, wifi::local_ip, ampel.macAddress, ESP.getFreeHeap(), esp_get_max_free_block_size(), esp_get_heap_fragmentation(), ampel.max_loop_duration, ampel.board, ampel.version, dd, hh, mm, ss); - // Serial.print(F(" - Body size : ")); - // Serial.print(strlen(content)); + Serial.print(F(" - Body size : ")); + Serial.print(strlen(content)); web_config::http.sendContent(content); // Script snprintf_P(content, sizeof(content), script_template, csv_writer::filename, ampel.sensorId); - // Serial.print(F(" - Script size : ")); - // Serial.println(strlen(content)); + Serial.print(F(" - Script size : ")); + Serial.println(strlen(content)); web_config::http.sendContent(content); } diff --git a/ampel-firmware/wifi_util.cpp b/ampel-firmware/wifi_util.cpp index 915445faf21a3f4554aaee87764f26af8789ba95..2026bb3542cdda170e812e2116c72867fc79ef3b 100644 --- a/ampel-firmware/wifi_util.cpp +++ b/ampel-firmware/wifi_util.cpp @@ -25,12 +25,14 @@ namespace wifi { web_config::update(); if (connected()) { break; - } else if (WiFi.status() == WL_NO_SHIELD) { // Access point, apparently + } else if (WiFi.status() == WL_NO_SHIELD) { // Access point, apparently FIXME: This doesn'T work for ESP826clipse6 led_effects::showKITTWheel(0xFF0015, 1); } else { led_effects::showRainbowWheel(); } - Serial.print("."); + Serial.print("Status : "); + Serial.println(WiFi.status()); +// Serial.print("."); } }