Commit 9f554958 authored by Eric Duminil's avatar Eric Duminil
Browse files

More headers on webpage

parent 716fcc70
......@@ -78,25 +78,30 @@ namespace web_server {
"<div class='pure-g'>\n"
//Sensor table
"<table id='table' class='pure-table-striped pure-u-1 pure-u-md-1-2'>\n"
"<tr><th>Sensor</th><th>%s</th></tr>\n"
"<tr><th colspan='2'>%s</th></tr>\n"
"<tr><td>CO<sub>2</sub> concentration</td><td>%5d ppm</td></tr>\n"
"<tr><td>Temperature</td><td>%.1f&#8451;</td></tr>\n"
"<tr><td>Humidity</td><td>%.1f%%</td></tr>\n"
"<tr><td>Last measurement</td><td>%s</td></tr>\n"
"<tr><td>Measurement timestep</td><td>%5d s</td></tr>\n"
#ifdef CSV_WRITER
"<tr><td>Last CSV write</td><td>%s</td></tr>\n"
"<tr><td>CSV timestep</td><td>%5d s</td></tr>\n"
"<tr><th colspan='2'>CSV</th></tr>\n"
"<tr><td>Last write</td><td>%s</td></tr>\n"
"<tr><td>Timestep</td><td>%5d s</td></tr>\n"
#endif
#ifdef MQTT
"<tr><td>Last MQTT publish</td><td>%s</td></tr>\n"
"<tr><td>MQTT publish timestep</td><td>%5d s</td></tr>\n"
"<tr><th colspan='2'>MQTT</th></tr>\n"
"<tr><td>Last publish</td><td>%s</td></tr>\n"
"<tr><td>Timestep</td><td>%5d s</td></tr>\n"
#endif
#if defined(LORAWAN) && defined(ESP32)
"<tr><td>Connected to LoRaWAN?</td><td>%s</td></tr>\n"
"<tr><td>Last LoRaWAN transmission</td><td>%s</td></tr>\n"
"<tr><td>LoRaWAN publish timestep</td><td>%5d s</td></tr>\n"
"<tr><th colspan='2'>LoRaWAN</th></tr>\n"
"<tr><td>Connected?</td><td>%s</td></tr>\n"
"<tr><td>Frequency</td><td>%s MHz</td></tr>\n"
"<tr><td>Last transmission</td><td>%s</td></tr>\n"
"<tr><td>Timestep</td><td>%5d s</td></tr>\n"
#endif
"<tr><th colspan='2'>Sensor</th></tr>\n"
"<tr><td>Temperature offset</td><td>%.1fK</td></tr>\n" //TODO: Read it from sensor?
"<tr><td>Local address</td><td><a href='http://%s.local/'>%s.local</a></td></tr>\n"
"<tr><td>Local IP</td><td><a href='http://%s'>%s</a></td></tr>\n"
......@@ -112,16 +117,16 @@ namespace web_server {
"<input type='submit' value='Delete CSV'/>"
"</form>\n"
#endif
"</div>\n"
"<a href='https://transfer.hft-stuttgart.de/gitlab/co2ampel/ampel-firmware' target='_blank'>Source code</a>\n"
"<a href='https://transfer.hft-stuttgart.de/gitlab/co2ampel/ampel-documentation' target='_blank'>Documentation</a>\n");
"</div>\n");
script_template = PSTR(
script_template =
PSTR(
"<a href='https://transfer.hft-stuttgart.de/gitlab/co2ampel/ampel-firmware' target='_blank'>Source code</a>\n"
"<a href='https://transfer.hft-stuttgart.de/gitlab/co2ampel/ampel-documentation' target='_blank'>Documentation</a>\n"
#ifdef CSV_WRITER
"<script>\n"
"document.body.style.cursor = 'default';\n"
"fetch('./%s',{credentials:'include'})\n"
// Get CSV, fill table and fill diagram
".then(response=>response.text())\n"
".then(csvText=>csvToTable(csvText))\n"
".then(htmlTable=>addLogTableToPage(htmlTable))\n"
......@@ -159,7 +164,8 @@ namespace web_server {
"function addLogTableToPage(table){document.getElementById('log').appendChild(table);}\n"
"</script>\n"
#endif
"</body>\n" "</html>");
"</body>\n"
"</html>");
// Web-server
http.on("/", handleWebServerRoot);
......@@ -196,7 +202,7 @@ namespace web_server {
//NOTE: Splitting in multiple parts in order to use less RAM
char content[2000]; // Update if needed
// Header size : 1611 - Body size : 1652 - Script size : 1688
// Header size : 1611 - Body size : 1800 - Script size : 1920
// Header
snprintf_P(content, sizeof(content), header_template, sensor::co2, SENSOR_ID.c_str(),
......@@ -215,7 +221,8 @@ namespace web_server {
mqtt::last_successful_publish.c_str(), config::sending_interval,
#endif
#if defined(LORAWAN) && defined(ESP32)
lorawan::connected ? "Yes" : "No", lorawan::last_transmission.c_str(), config::lorawan_sending_interval,
lorawan::connected ? "Yes" : "No", LMIC_FREQUENCY_PLAN, lorawan::last_transmission.c_str(),
config::lorawan_sending_interval,
#endif
config::temperature_offset, SENSOR_ID.c_str(), SENSOR_ID.c_str(), WiFi.localIP().toString().c_str(),
WiFi.localIP().toString().c_str(), get_free_heap_size(), available_fs_space, max_loop_duration, BOARD, hh, mm,
......
Supports Markdown
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