From d3096179983c75f2bed9152fcae0af448f5e3656 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beat=20K=C3=BCng?= Date: Wed, 3 May 2017 16:43:27 +0200 Subject: [PATCH] param.c: rename to cpp and add module documentation use c++ so that raw string literals can be used --- src/systemcmds/param/CMakeLists.txt | 2 +- src/systemcmds/param/{param.c => param.cpp} | 25 ++++++++++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) rename src/systemcmds/param/{param.c => param.cpp} (95%) diff --git a/src/systemcmds/param/CMakeLists.txt b/src/systemcmds/param/CMakeLists.txt index e3f4955735..a8b315c313 100644 --- a/src/systemcmds/param/CMakeLists.txt +++ b/src/systemcmds/param/CMakeLists.txt @@ -37,7 +37,7 @@ px4_add_module( COMPILE_FLAGS -Wno-array-bounds SRCS - param.c + param.cpp DEPENDS platforms__common ) diff --git a/src/systemcmds/param/param.c b/src/systemcmds/param/param.cpp similarity index 95% rename from src/systemcmds/param/param.c rename to src/systemcmds/param/param.cpp index 3c12040063..9e5d71f310 100644 --- a/src/systemcmds/param/param.c +++ b/src/systemcmds/param/param.cpp @@ -32,7 +32,7 @@ ****************************************************************************/ /** - * @file param.c + * @file param.cpp * @author Lorenz Meier * @author Andreas Antener * @@ -64,7 +64,9 @@ #endif #include "systemlib/err.h" +__BEGIN_DECLS __EXPORT int param_main(int argc, char *argv[]); +__END_DECLS enum COMPARE_OPERATOR { COMPARE_OPERATOR_EQUAL = 0, @@ -92,6 +94,27 @@ static int do_find(const char *name); static void print_usage(void) { + PRINT_MODULE_DESCRIPTION( + R"DESCR_STR( +### Description +Command to access and manipulate parameters via shell or script. + +This is used for example in the startup script to set airframe-specific parameters. + +Parameters are automatically saved when changed, eg. with `param set`. They are typically stored to FRAM +or to the SD card. `param select` can be used to change the storage location for subsequent saves (this will +need to be (re-)configured on every boot). + +Each parameter has a 'used' flag, which is set when it's read during boot. It is used to only show relevant +parameters to a ground control station. + +### Examples +Change the airframe and make sure the airframe's default parameters are loaded: +$ param set SYS_AUTOSTART 4001 +$ param set SYS_AUTOCONFIG 1 +$ reboot +)DESCR_STR"); + PRINT_MODULE_USAGE_NAME("param", "command"); PRINT_MODULE_USAGE_COMMAND_DESCR("load", "Load params from a file (overwrite all)"); PRINT_MODULE_USAGE_ARG("", "File name (use default if not given)", true);