Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Käppler
ampel-firmware
Commits
4201db6d
Commit
4201db6d
authored
Dec 27, 2020
by
Eric Duminil
Browse files
CSV_WRITER -> AMPEL_CSV
parent
f9bfce6d
Changes
5
Hide whitespace changes
Inline
Side-by-side
ampel-firmware.h
View file @
4201db6d
...
...
@@ -9,7 +9,7 @@
# error Missing config.h file. Please copy config.example.h to config.h.
#endif
#ifdef
CSV_WRITER
#ifdef
AMPEL_CSV
# include "csv_writer.h"
#endif
#ifdef AMPEL_MQTT
...
...
ampel-firmware.ino
View file @
4201db6d
...
...
@@ -100,7 +100,7 @@ void setup() {
#endif
}
#ifdef
CSV_WRITER
#ifdef
AMPEL_CSV
csv_writer
::
initialize
();
#endif
...
...
@@ -133,7 +133,7 @@ void loop() {
checkFlashButton
();
if
(
sensor
::
processData
())
{
#ifdef
CSV_WRITER
#ifdef
AMPEL_CSV
csv_writer
::
logIfTimeHasCome
(
sensor
::
timestamp
,
sensor
::
co2
,
sensor
::
temperature
,
sensor
::
humidity
);
#endif
...
...
config.public.h
View file @
4201db6d
...
...
@@ -27,7 +27,7 @@
# define MQTT_SENDING_INTERVAL 300 // [s]
// 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 ?
// Probably a good idea to use a multiple of MEASUREMENT_TIMESTEP, so that averages can be calculated
...
...
web_server.cpp
View file @
4201db6d
...
...
@@ -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-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
"
#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='#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
"
...
...
@@ -84,7 +84,7 @@ namespace web_server {
"<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
#ifdef
AMPEL_CSV
"<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
"
...
...
@@ -112,7 +112,7 @@ namespace web_server {
"<tr><td>Uptime</td><td>%4d h %02d min %02d s</td></tr>
\n
"
"</table>
\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');
\"
>"
"<input type='submit' value='Delete CSV'/>"
"</form>
\n
"
...
...
@@ -123,7 +123,7 @@ namespace web_server {
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
#ifdef
AMPEL_CSV
"<script>
\n
"
"document.body.style.cursor = 'default';
\n
"
"fetch('./%s',{credentials:'include'})
\n
"
...
...
@@ -169,7 +169,7 @@ namespace web_server {
// Web-server
http
.
on
(
"/"
,
handleWebServerRoot
);
#ifdef
CSV_WRITER
#ifdef
AMPEL_CSV
http
.
on
(
"/"
+
csv_writer
::
filename
,
handleWebServerCSV
);
http
.
on
(
"/delete_csv"
,
HTTP_POST
,
handleDeleteCSV
);
#endif
...
...
@@ -214,7 +214,7 @@ namespace web_server {
// Body
snprintf_P
(
content
,
sizeof
(
content
),
body_template
,
SENSOR_ID
.
c_str
(),
sensor
::
co2
,
sensor
::
temperature
,
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
,
#endif
#ifdef AMPEL_MQTT
...
...
web_server.h
View file @
4201db6d
...
...
@@ -9,7 +9,7 @@
#include
"config.h"
#include
"util.h"
#include
"co2_sensor.h"
#ifdef
CSV_WRITER
#ifdef
AMPEL_CSV
# include "csv_writer.h"
#endif
#ifdef AMPEL_MQTT
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment