Commit 4201db6d authored by Eric Duminil's avatar Eric Duminil
Browse files

CSV_WRITER -> AMPEL_CSV

parent f9bfce6d
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
# error Missing config.h file. Please copy config.example.h to config.h. # error Missing config.h file. Please copy config.example.h to config.h.
#endif #endif
#ifdef CSV_WRITER #ifdef AMPEL_CSV
# include "csv_writer.h" # include "csv_writer.h"
#endif #endif
#ifdef AMPEL_MQTT #ifdef AMPEL_MQTT
......
...@@ -100,7 +100,7 @@ void setup() { ...@@ -100,7 +100,7 @@ void setup() {
#endif #endif
} }
#ifdef CSV_WRITER #ifdef AMPEL_CSV
csv_writer::initialize(); csv_writer::initialize();
#endif #endif
...@@ -133,7 +133,7 @@ void loop() { ...@@ -133,7 +133,7 @@ void loop() {
checkFlashButton(); checkFlashButton();
if (sensor::processData()) { if (sensor::processData()) {
#ifdef CSV_WRITER #ifdef AMPEL_CSV
csv_writer::logIfTimeHasCome(sensor::timestamp, sensor::co2, sensor::temperature, sensor::humidity); csv_writer::logIfTimeHasCome(sensor::timestamp, sensor::co2, sensor::temperature, sensor::humidity);
#endif #endif
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
# define MQTT_SENDING_INTERVAL 300 // [s] # define MQTT_SENDING_INTERVAL 300 // [s]
// Should data be written to the sensor Flash memory? Writing too often might damage the ESP memory // Should data be written to the sensor Flash memory? Writing too often might damage the ESP memory
# define CSV_WRITER // Comment or remove this line if you want to disable CSV logging. # define AMPEL_CSV // Comment or remove this line if you want to disable CSV logging.
// How often should measurements be appended to CSV ? // How often should measurements be appended to CSV ?
// Probably a good idea to use a multiple of MEASUREMENT_TIMESTEP, so that averages can be calculated // Probably a good idea to use a multiple of MEASUREMENT_TIMESTEP, so that averages can be calculated
......
...@@ -58,7 +58,7 @@ namespace web_server { ...@@ -58,7 +58,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-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" "<div class='pure-u-1'><ul class='pure-menu pure-menu-horizontal pure-menu-list'>\n"
"<li class='pure-menu-item'><a href='#table' class='pure-menu-link'>Info</a></li>\n" "<li class='pure-menu-item'><a href='#table' class='pure-menu-link'>Info</a></li>\n"
#ifdef CSV_WRITER #ifdef AMPEL_CSV
"<li class='pure-menu-item'><a href='#graph' class='pure-menu-link'>Graph</a></li>\n" "<li class='pure-menu-item'><a href='#graph' class='pure-menu-link'>Graph</a></li>\n"
"<li class='pure-menu-item'><a href='#log' class='pure-menu-link'>Log</a></li>\n" "<li class='pure-menu-item'><a href='#log' class='pure-menu-link'>Log</a></li>\n"
"<li class='pure-menu-item'><a href='./%s' class='pure-menu-link'>Download CSV</a></li>\n" "<li class='pure-menu-item'><a href='./%s' class='pure-menu-link'>Download CSV</a></li>\n"
...@@ -84,7 +84,7 @@ namespace web_server { ...@@ -84,7 +84,7 @@ namespace web_server {
"<tr><td>Humidity</td><td>%.1f%%</td></tr>\n" "<tr><td>Humidity</td><td>%.1f%%</td></tr>\n"
"<tr><td>Last measurement</td><td>%s</td></tr>\n" "<tr><td>Last measurement</td><td>%s</td></tr>\n"
"<tr><td>Measurement timestep</td><td>%5d s</td></tr>\n" "<tr><td>Measurement timestep</td><td>%5d s</td></tr>\n"
#ifdef CSV_WRITER #ifdef AMPEL_CSV
"<tr><th colspan='2'>CSV</th></tr>\n" "<tr><th colspan='2'>CSV</th></tr>\n"
"<tr><td>Last write</td><td>%s</td></tr>\n" "<tr><td>Last write</td><td>%s</td></tr>\n"
"<tr><td>Timestep</td><td>%5d s</td></tr>\n" "<tr><td>Timestep</td><td>%5d s</td></tr>\n"
...@@ -112,7 +112,7 @@ namespace web_server { ...@@ -112,7 +112,7 @@ namespace web_server {
"<tr><td>Uptime</td><td>%4d h %02d min %02d s</td></tr>\n" "<tr><td>Uptime</td><td>%4d h %02d min %02d s</td></tr>\n"
"</table>\n" "</table>\n"
"<div id='log' class='pure-u-1 pure-u-md-1-2'></div>\n" "<div id='log' class='pure-u-1 pure-u-md-1-2'></div>\n"
#ifdef CSV_WRITER #ifdef AMPEL_CSV
"<form action='/delete_csv' method='POST' onsubmit=\"return confirm('Are you really sure you want to delete all data?') && (document.body.style.cursor = 'wait');\">" "<form action='/delete_csv' method='POST' onsubmit=\"return confirm('Are you really sure you want to delete all data?') && (document.body.style.cursor = 'wait');\">"
"<input type='submit' value='Delete CSV'/>" "<input type='submit' value='Delete CSV'/>"
"</form>\n" "</form>\n"
...@@ -123,7 +123,7 @@ namespace web_server { ...@@ -123,7 +123,7 @@ namespace web_server {
PSTR( 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-firmware' target='_blank'>Source code</a>\n"
"<a href='https://transfer.hft-stuttgart.de/gitlab/co2ampel/ampel-documentation' target='_blank'>Documentation</a>\n" "<a href='https://transfer.hft-stuttgart.de/gitlab/co2ampel/ampel-documentation' target='_blank'>Documentation</a>\n"
#ifdef CSV_WRITER #ifdef AMPEL_CSV
"<script>\n" "<script>\n"
"document.body.style.cursor = 'default';\n" "document.body.style.cursor = 'default';\n"
"fetch('./%s',{credentials:'include'})\n" "fetch('./%s',{credentials:'include'})\n"
...@@ -169,7 +169,7 @@ namespace web_server { ...@@ -169,7 +169,7 @@ namespace web_server {
// Web-server // Web-server
http.on("/", handleWebServerRoot); http.on("/", handleWebServerRoot);
#ifdef CSV_WRITER #ifdef AMPEL_CSV
http.on("/" + csv_writer::filename, handleWebServerCSV); http.on("/" + csv_writer::filename, handleWebServerCSV);
http.on("/delete_csv", HTTP_POST, handleDeleteCSV); http.on("/delete_csv", HTTP_POST, handleDeleteCSV);
#endif #endif
...@@ -214,7 +214,7 @@ namespace web_server { ...@@ -214,7 +214,7 @@ namespace web_server {
// Body // Body
snprintf_P(content, sizeof(content), body_template, SENSOR_ID.c_str(), sensor::co2, sensor::temperature, snprintf_P(content, sizeof(content), body_template, SENSOR_ID.c_str(), sensor::co2, sensor::temperature,
sensor::humidity, sensor::timestamp.c_str(), config::measurement_timestep, sensor::humidity, sensor::timestamp.c_str(), config::measurement_timestep,
#ifdef CSV_WRITER #ifdef AMPEL_CSV
csv_writer::last_successful_write.c_str(), config::csv_interval, csv_writer::last_successful_write.c_str(), config::csv_interval,
#endif #endif
#ifdef AMPEL_MQTT #ifdef AMPEL_MQTT
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include "config.h" #include "config.h"
#include "util.h" #include "util.h"
#include "co2_sensor.h" #include "co2_sensor.h"
#ifdef CSV_WRITER #ifdef AMPEL_CSV
# include "csv_writer.h" # include "csv_writer.h"
#endif #endif
#ifdef AMPEL_MQTT #ifdef AMPEL_MQTT
......
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