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
9db226d7
Commit
9db226d7
authored
Apr 17, 2021
by
Eric Duminil
Browse files
Some doc
parent
8b3997b0
Changes
2
Hide whitespace changes
Inline
Side-by-side
ampel-firmware/sensor_commands.cpp
View file @
9db226d7
...
...
@@ -43,6 +43,10 @@ namespace sensor_commands {
}
}
/*
* Tries to split a string command (e.g. 'mqtt 60' or 'show_csv') into a function_name and an argument.
* Returns 0 if both are found, 1 if there is a problem and 2 if no argument is found.
*/
uint8_t
parseCommand
(
const
char
*
command
,
char
*
function_name
,
int32_t
&
argument
)
{
char
split_command
[
MAX_COMMAND_SIZE
];
strlcpy
(
split_command
,
command
,
MAX_COMMAND_SIZE
);
...
...
@@ -83,6 +87,9 @@ namespace sensor_commands {
led_effects
::
showKITTWheel
(
color
::
red
,
1
);
}
/*
* Tries to find the corresponding callback for a given command. Name and number of argument should fit.
*/
void
run
(
const
char
*
command
)
{
char
function_name
[
MAX_COMMAND_SIZE
];
int32_t
argument
=
0
;
...
...
ampel-firmware/sensor_commands.h
View file @
9db226d7
...
...
@@ -3,7 +3,7 @@
/** Other scripts can use this namespace, in order to define callbacks.
* Those callbacks can then be used to send commands to the sensor (reset, calibrate, night mode, ...)
*
*
The callbacks can either have no parameter, or one int32_t parameter.
*/
namespace
sensor_commands
{
...
...
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