Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
co2ampel
ampel-firmware
Commits
8b3997b0
Commit
8b3997b0
authored
Apr 17, 2021
by
Eric Duminil
Browse files
show_csv command
parent
34cf4989
Changes
2
Hide whitespace changes
Inline
Side-by-side
ampel-firmware/csv_writer.cpp
View file @
8b3997b0
#include
"csv_writer.h"
//TODO: Allow CSV download via USB Serial, when requested (e.g. via a Python script)
namespace
config
{
// Values should be defined in config.h
uint16_t
csv_interval
=
CSV_INTERVAL
;
// [s]
...
...
@@ -119,6 +117,7 @@ namespace csv_writer {
sensor_commands
::
defineIntCallback
(
"csv"
,
setCSVinterval
,
" 60 (Sets CSV writing interval, in s)"
);
sensor_commands
::
defineCallback
(
"format_filesystem"
,
formatFilesystem
,
" (Deletes the whole filesystem)"
);
sensor_commands
::
defineCallback
(
"show_csv"
,
showCSVContent
,
" (Displays the complete CSV file on Serial)"
);
}
File
openOrCreate
()
{
...
...
@@ -176,6 +175,21 @@ namespace csv_writer {
led_effects
::
showKITTWheel
(
color
::
green
,
1
);
}
void
showCSVContent
()
{
Serial
.
print
(
F
(
"### "
));
Serial
.
print
(
filename
);
Serial
.
println
(
F
(
" ###"
));
File
csv_file
;
if
(
FS_LIB
.
exists
(
filename
))
{
csv_file
=
FS_LIB
.
open
(
filename
,
"r"
);
while
(
csv_file
.
available
())
{
Serial
.
write
(
csv_file
.
read
());
}
csv_file
.
close
();
}
Serial
.
println
(
F
(
"################"
));
}
void
formatFilesystem
()
{
FS_LIB
.
format
();
led_effects
::
showKITTWheel
(
color
::
blue
,
2
);
...
...
ampel-firmware/csv_writer.h
View file @
8b3997b0
...
...
@@ -27,6 +27,7 @@ namespace csv_writer {
extern
const
String
filename
;
void
setCSVinterval
(
int32_t
csv_interval
);
void
showCSVContent
();
void
formatFilesystem
();
}
...
...
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