Commit 082bc7a1 authored by Eric Duminil's avatar Eric Duminil
Browse files

More balanced html parts

parent 5911f3d9
Pipeline #2834 passed with stage
in 1 minute and 37 seconds
......@@ -73,16 +73,15 @@ namespace web_server {
// Show a colored dot on the webpage, with a similar color than on LED Ring.
"hue=(1-(Math.min(Math.max(parseInt(document.title),500),1600)-500)/1100)*120;\n"
"document.getElementById('led').style.color=['hsl(',hue,',100%%,50%%)'].join('');\n"
"</script>\n");
body_template =
PSTR("<div class='pure-g'>\n"
"<div class='pure-u-1' id='graph'></div>\n" // Graph placeholder
"</script>\n"
"<div class='pure-g'>\n"
"<div class='pure-u-1' id='graph'></div>\n"// Graph placeholder
"</div>\n"
"<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 colspan='2'>%s</th></tr>\n"
"<table id='table' class='pure-table-striped pure-u-1 pure-u-md-1-2'>\n");
body_template =
PSTR("<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"
......@@ -211,9 +210,8 @@ 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 : 1800 - Script size : 1920
// INFO - Header size : 1767 - Body size : 1812 - Script size : 1909
// Header
snprintf_P(content, sizeof(content), header_template, sensor::co2, SENSOR_ID.c_str(),
WiFi.localIP().toString().c_str()
#ifdef AMPEL_CSV
......@@ -221,6 +219,8 @@ namespace web_server {
#endif
);
Serial.print(F("INFO - Header size : "));
Serial.print(strlen(content));
http.setContentLength(CONTENT_LENGTH_UNKNOWN);
http.send_P(200, PSTR("text/html"), content);
......@@ -241,7 +241,9 @@ namespace web_server {
WiFi.localIP().toString().c_str(), WiFi.localIP().toString().c_str(), get_free_heap_size(), max_loop_duration,
BOARD, dd, hh, mm, ss);
Serial.print(F(" - Body size : "));
http.sendContent(content);
Serial.print(strlen(content));
// Script
snprintf_P(content, sizeof(content), script_template
......@@ -250,6 +252,8 @@ namespace web_server {
#endif
);
Serial.print(F(" - Script size : "));
Serial.println(strlen(content));
http.sendContent(content);
}
......
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