Skip to content
Snippets Groups Projects
Commit 15044909 authored by Beat Küng's avatar Beat Küng
Browse files

param: add 'param touch <param_name>' command

so that params can be marked as used from scripts.
parent 91a1ac1b
No related branches found
No related tags found
No related merge requests found
......@@ -87,6 +87,7 @@ static void do_show_print(void *arg, param_t param);
static int do_set(const char *name, const char *val, bool fail_on_not_found);
static int do_compare(const char *name, char *vals[], unsigned comparisons, enum COMPARE_OPERATOR cmd_op);
static int do_reset(const char *excludes[], int num_excludes);
static int do_touch(const char *params[], int num_params);
static int do_reset_nostart(const char *excludes[], int num_excludes);
static int do_find(const char *name);
......@@ -140,6 +141,9 @@ $ reboot
"Compare a param with a value. Command will succeed if param is greater than the value");
PRINT_MODULE_USAGE_ARG("<param_name> <value>", "Parameter name and value to compare", false);
PRINT_MODULE_USAGE_COMMAND_DESCR("touch", "Mark a parameter as used");
PRINT_MODULE_USAGE_ARG("<param_name1> [<param_name2>]", "Parameter name (one or more)", true);
PRINT_MODULE_USAGE_COMMAND_DESCR("reset", "Reset params to default");
PRINT_MODULE_USAGE_ARG("<exclude1> [<exclude2>]", "Do not reset matching params (wildcard at end allowed)", true);
PRINT_MODULE_USAGE_COMMAND_DESCR("reset_nostart",
......@@ -275,6 +279,15 @@ param_main(int argc, char *argv[])
}
}
if (!strcmp(argv[1], "touch")) {
if (argc >= 3) {
return do_touch((const char **) &argv[2], argc - 2);
} else {
PX4_ERR("not enough arguments.");
return 1;
}
}
if (!strcmp(argv[1], "reset_nostart")) {
if (argc >= 3) {
return do_reset_nostart((const char **) &argv[2], argc - 2);
......@@ -759,6 +772,17 @@ do_reset(const char *excludes[], int num_excludes)
return 0;
}
static int
do_touch(const char *params[], int num_params)
{
for (int i = 0; i < num_params; ++i) {
if (param_find(params[i]) == PARAM_INVALID) {
PX4_ERR("param %s not found", params[i]);
}
}
return 0;
}
static int
do_reset_nostart(const char *excludes[], int num_excludes)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment