aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndreas Antener <antener_a@gmx.ch>2015-01-30 11:21:47 +0100
committerLorenz Meier <lm@inf.ethz.ch>2015-02-10 08:39:46 +0100
commitf2c1d6d66d628a5419c3be0a37552a45d63f77dd (patch)
treeb4a904fb789f61ea40bbbdc3a1de5f98aef43be4 /src
parent7c63be745041ed2b7db253ef0c97b76d23a61617 (diff)
downloadpx4-firmware-f2c1d6d66d628a5419c3be0a37552a45d63f77dd.tar.gz
px4-firmware-f2c1d6d66d628a5419c3be0a37552a45d63f77dd.tar.bz2
px4-firmware-f2c1d6d66d628a5419c3be0a37552a45d63f77dd.zip
implemented reset excludes in systemcmd "param", updated autoconfig parameter doc
Diffstat (limited to 'src')
-rw-r--r--src/modules/systemlib/system_params.c5
-rw-r--r--src/systemcmds/param/param.c43
2 files changed, 33 insertions, 15 deletions
diff --git a/src/modules/systemlib/system_params.c b/src/modules/systemlib/system_params.c
index a0988035c..497b7da37 100644
--- a/src/modules/systemlib/system_params.c
+++ b/src/modules/systemlib/system_params.c
@@ -52,8 +52,9 @@ PARAM_DEFINE_INT32(SYS_AUTOSTART, 0);
/**
* Automatically configure default values.
*
- * Set to 1 to set platform-specific parameters to their default
- * values on next system startup.
+ * Set to 1 to reset parameters on next system startup (setting defaults).
+ * Platform-specific values are used if available.
+ * RC* parameters are preserved.
*
* @min 0
* @max 1
diff --git a/src/systemcmds/param/param.c b/src/systemcmds/param/param.c
index 0b6d3b8d3..7273c4148 100644
--- a/src/systemcmds/param/param.c
+++ b/src/systemcmds/param/param.c
@@ -1,6 +1,6 @@
/****************************************************************************
*
- * Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved.
+ * Copyright (c) 2012-2015 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -33,7 +33,8 @@
/**
* @file param.c
- * @author Lorenz Meier <lm@inf.ethz.ch>
+ * @author Lorenz Meier <lorenz@px4.io>
+ * @author Andreas Antener <andreas@uaventure.com>
*
* Parameter tool.
*/
@@ -62,10 +63,10 @@ static void do_load(const char *param_file_name);
static void do_import(const char *param_file_name);
static void do_show(const char *search_string);
static void do_show_print(void *arg, param_t param);
-static void do_set(const char *name, const char *val, bool fail_on_not_found);
-static void do_compare(const char *name, char *vals[], unsigned comparisons);
-static void do_reset(void);
-static void do_reset_nostart(void);
+static void do_set(const char* name, const char* val, bool fail_on_not_found);
+static void do_compare(const char* name, char* vals[], unsigned comparisons);
+static void do_reset(const char* excludes[], int num_excludes);
+static void do_reset_nostart(const char* excludes[], int num_excludes);
int
param_main(int argc, char *argv[])
@@ -151,11 +152,19 @@ param_main(int argc, char *argv[])
}
if (!strcmp(argv[1], "reset")) {
- do_reset();
+ if (argc >= 3) {
+ do_reset((const char**) &argv[2], argc - 2);
+ } else {
+ do_reset(NULL, 0);
+ }
}
if (!strcmp(argv[1], "reset_nostart")) {
- do_reset_nostart();
+ if (argc >= 3) {
+ do_reset_nostart((const char**) &argv[2], argc - 2);
+ } else {
+ do_reset_nostart(NULL, 0);
+ }
}
}
@@ -452,10 +461,14 @@ do_compare(const char *name, char *vals[], unsigned comparisons)
}
static void
-do_reset(void)
+do_reset(const char* excludes[], int num_excludes)
{
- param_reset_all();
-
+ if (num_excludes > 0) {
+ param_reset_excludes(excludes, num_excludes);
+ } else {
+ param_reset_all();
+ }
+
if (param_save_default()) {
warnx("Param export failed.");
exit(1);
@@ -466,7 +479,7 @@ do_reset(void)
}
static void
-do_reset_nostart(void)
+do_reset_nostart(const char* excludes[], int num_excludes)
{
int32_t autostart;
@@ -475,7 +488,11 @@ do_reset_nostart(void)
(void)param_get(param_find("SYS_AUTOSTART"), &autostart);
(void)param_get(param_find("SYS_AUTOCONFIG"), &autoconfig);
- param_reset_all();
+ if (num_excludes > 0) {
+ param_reset_excludes(excludes, num_excludes);
+ } else {
+ param_reset_all();
+ }
(void)param_set(param_find("SYS_AUTOSTART"), &autostart);
(void)param_set(param_find("SYS_AUTOCONFIG"), &autoconfig);