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
6e522d4e
Commit
6e522d4e
authored
Apr 17, 2021
by
Eric Duminil
Browse files
Simpler log
parent
591e2082
Changes
2
Hide whitespace changes
Inline
Side-by-side
ampel-firmware/sensor_commands.cpp
View file @
6e522d4e
...
...
@@ -5,6 +5,7 @@ namespace sensor_commands {
const
uint8_t
MAX_COMMAND_SIZE
=
30
;
uint8_t
callbacks_count
=
0
;
//TODO: Add example? Add description?
struct
Callback
{
Callback
(
const
char
*
s
=
0
,
void
(
*
f
)(
int32_t
)
=
0
)
:
name
(
s
),
function
(
f
)
{
...
...
@@ -57,22 +58,19 @@ namespace sensor_commands {
}
void
listAvailableCallbacks
()
{
Serial
.
println
(
"DEBUG -
Available commands :"
);
Serial
.
println
(
F
(
"Message not supported. Doing nothing.
Available commands :"
)
)
;
for
(
uint8_t
i
=
0
;
i
<
callbacks_count
;
i
++
)
{
Serial
.
print
(
" "
);
Serial
.
println
(
callbacks
[
i
].
name
);
Serial
.
print
(
callbacks
[
i
].
name
);
Serial
.
println
(
" 1234"
);
}
led_effects
::
showKITTWheel
(
color
::
red
,
1
);
Serial
.
println
(
F
(
"Message not supported. Doing nothing."
));
}
void
run
(
const
char
*
command
)
{
char
function_name
[
MAX_COMMAND_SIZE
];
int32_t
parameter
;
if
(
parseCommand
(
command
,
function_name
,
parameter
))
{
listAvailableCallbacks
();
return
;
}
parseCommand
(
command
,
function_name
,
parameter
);
for
(
uint8_t
i
=
0
;
i
<
callbacks_count
;
i
++
)
{
if
(
!
strcmp
(
function_name
,
callbacks
[
i
].
name
))
{
...
...
ampel-firmware/web_server.h
View file @
6e522d4e
...
...
@@ -9,6 +9,7 @@
#include
"config.h"
#include
"util.h"
#include
"co2_sensor.h"
#include
"sensor_commands.h"
#ifdef AMPEL_CSV
# include "csv_writer.h"
#endif
...
...
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