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
3ae4adb6
Commit
3ae4adb6
authored
Apr 16, 2021
by
Eric Duminil
Browse files
CSV interval
parent
0dad2457
Changes
3
Hide whitespace changes
Inline
Side-by-side
ampel-firmware/csv_writer.cpp
View file @
3ae4adb6
...
...
@@ -86,6 +86,14 @@ namespace csv_writer {
return
getTotalSpace
()
-
getUsedSpace
();
}
void
setCSVinterval
(
int32_t
csv_interval
)
{
config
::
csv_interval
=
csv_interval
;
Serial
.
print
(
F
(
"Setting CSV Interval to : "
));
Serial
.
print
(
config
::
csv_interval
);
Serial
.
println
(
"s."
);
led_effects
::
showKITTWheel
(
color
::
green
,
1
);
}
void
initialize
()
{
Serial
.
print
(
F
(
"Initializing FS..."
));
if
(
mountFS
())
{
...
...
@@ -116,6 +124,8 @@ namespace csv_writer {
Serial
.
println
(
"Filesystem content:"
);
showFilesystemContent
();
Serial
.
println
();
sensor_commands
::
defineCallback
(
"csv"
,
setCSVinterval
);
}
File
openOrCreate
()
{
...
...
ampel-firmware/csv_writer.h
View file @
3ae4adb6
...
...
@@ -14,6 +14,7 @@
#include
"config.h"
#include
"util.h"
#include
"led_effects.h"
#include
"sensor_commands.h"
namespace
config
{
extern
uint16_t
csv_interval
;
// [s]
...
...
ampel-firmware/mqtt.cpp
View file @
3ae4adb6
...
...
@@ -64,17 +64,6 @@ namespace mqtt {
led_effects
::
showKITTWheel
(
color
::
green
,
1
);
}
#ifdef AMPEL_CSV
void
setCSVinterval
(
String
messageString
)
{
messageString
.
replace
(
"csv "
,
""
);
config
::
csv_interval
=
messageString
.
toInt
();
Serial
.
print
(
F
(
"Setting CSV Interval to : "
));
Serial
.
print
(
config
::
csv_interval
);
Serial
.
println
(
"s."
);
led_effects
::
showKITTWheel
(
color
::
green
,
1
);
}
#endif
void
calibrateSensorToSpecificPPM
(
String
messageString
)
{
messageString
.
replace
(
"calibrate "
,
""
);
long
int
calibrationLevel
=
messageString
.
toInt
();
...
...
@@ -135,8 +124,6 @@ namespace mqtt {
Serial
.
println
(
F
(
"Forcing MQTT publish now."
));
publish
(
sensor
::
timestamp
,
sensor
::
co2
,
sensor
::
temperature
,
sensor
::
humidity
);
#ifdef AMPEL_CSV
}
else
if
(
messageString
.
startsWith
(
"csv "
))
{
setCSVinterval
(
messageString
);
}
else
if
(
messageString
==
"format_filesystem"
)
{
FS_LIB
.
format
();
led_effects
::
showKITTWheel
(
color
::
blue
,
2
);
...
...
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