diff --git a/src/systemcmds/param/param.cpp b/src/systemcmds/param/param.cpp index 0cd534be7b..4a692516eb 100644 --- a/src/systemcmds/param/param.cpp +++ b/src/systemcmds/param/param.cpp @@ -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(" ", "Parameter name and value to compare", false); + PRINT_MODULE_USAGE_COMMAND_DESCR("touch", "Mark a parameter as used"); + PRINT_MODULE_USAGE_ARG(" []", "Parameter name (one or more)", true); + PRINT_MODULE_USAGE_COMMAND_DESCR("reset", "Reset params to default"); PRINT_MODULE_USAGE_ARG(" []", "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) {