Commit 16536c99 authored by Eric Duminil's avatar Eric Duminil
Browse files

Debug

parent db032606
......@@ -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];
......
......@@ -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);
}
......
......@@ -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(".");
}
}
......
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