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
755f8578
Commit
755f8578
authored
Apr 16, 2021
by
Eric Duminil
Browse files
Looking for corresponding code
parent
96d9138d
Changes
1
Hide whitespace changes
Inline
Side-by-side
ampel-firmware/sensor_commands.cpp
View file @
755f8578
...
...
@@ -59,10 +59,19 @@ namespace sensor_commands {
return
0
;
}
void
listAvailableCallbacks
()
{
Serial
.
println
(
"DEBUG - Available commands :"
);
for
(
uint8_t
i
=
0
;
i
<
callbacks_count
;
i
++
)
{
Serial
.
print
(
" "
);
Serial
.
println
(
callbacks
[
i
].
name
);
}
}
void
run
(
const
char
*
command
)
{
char
function_name
[
MAX_COMMAND_SIZE
];
long
parameter
;
if
(
parseCommand
(
command
,
function_name
,
parameter
))
{
listAvailableCallbacks
();
return
;
}
Serial
.
print
(
"Command : '"
);
...
...
@@ -72,14 +81,15 @@ namespace sensor_commands {
// Test all the callbacks.
for
(
uint8_t
i
=
0
;
i
<
callbacks_count
;
i
++
)
{
if
(
startsWith
(
function_name
,
callbacks
[
i
].
name
))
{
Serial
.
print
(
"OHHHH YES!!!"
);
if
(
!
strcmp
(
function_name
,
callbacks
[
i
].
name
))
{
Serial
.
print
(
"Function found!!!"
);
Serial
.
print
(
"Trying '"
);
Serial
.
print
(
callbacks
[
i
].
name
);
Serial
.
println
(
"'"
);
callbacks
[
i
].
function
(
callbacks
[
i
].
data
);
return
;
}
Serial
.
print
(
"Trying '"
);
Serial
.
print
(
callbacks
[
i
].
name
);
Serial
.
println
(
"'"
);
callbacks
[
i
].
function
(
callbacks
[
i
].
data
);
}
Serial
.
println
(
"Done."
);
listAvailableCallbacks
(
);
}
}
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