aboutsummaryrefslogtreecommitdiff
path: root/src/modules/systemlib/param/param.c
diff options
context:
space:
mode:
authorAndreas Antener <antener_a@gmx.ch>2015-01-30 11:21:05 +0100
committerLorenz Meier <lm@inf.ethz.ch>2015-02-10 08:38:13 +0100
commit7c63be745041ed2b7db253ef0c97b76d23a61617 (patch)
tree9725f044fed965fe2b49c881426c5ee4e4a73def /src/modules/systemlib/param/param.c
parent4b1ddba817af08a2010c59142c58ea6233e85e99 (diff)
downloadpx4-firmware-7c63be745041ed2b7db253ef0c97b76d23a61617.tar.gz
px4-firmware-7c63be745041ed2b7db253ef0c97b76d23a61617.tar.bz2
px4-firmware-7c63be745041ed2b7db253ef0c97b76d23a61617.zip
implemented reset with excludes
Diffstat (limited to 'src/modules/systemlib/param/param.c')
-rw-r--r--src/modules/systemlib/param/param.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/modules/systemlib/param/param.c b/src/modules/systemlib/param/param.c
index 7f5caf18f..68721598d 100644
--- a/src/modules/systemlib/param/param.c
+++ b/src/modules/systemlib/param/param.c
@@ -488,6 +488,31 @@ param_reset_all(void)
param_notify_changes();
}
+void
+param_reset_excludes(const char* excludes[], int num_excludes)
+{
+ param_lock();
+
+ param_t param;
+
+ for (param = 0; handle_in_range(param); param++) {
+ const char* name = param_name(param);
+
+ for (int index = 0, len = strlen(excludes[index]); index < num_excludes; index ++) {
+ if((excludes[index][len - 1] == '*'
+ && strncmp(name, excludes[index], strlen(excludes[index]))) == 0
+ || strcmp(name, excludes[index]) == 0) {
+
+ param_reset(param);
+ }
+ }
+ }
+
+ param_unlock();
+
+ param_notify_changes();
+}
+
static const char *param_default_file = "/eeprom/parameters";
static char *param_user_file = NULL;