mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-02 11:59:17 +08:00
implemented reset excludes in systemcmd "param", updated autoconfig parameter doc
This commit is contained in:
committed by
Lorenz Meier
parent
7c63be7450
commit
f2c1d6d66d
@@ -122,8 +122,8 @@ then
|
|||||||
#
|
#
|
||||||
if param compare SYS_AUTOCONFIG 1
|
if param compare SYS_AUTOCONFIG 1
|
||||||
then
|
then
|
||||||
# Wipe out params
|
# Wipe out params except RC*
|
||||||
param reset_nostart
|
param reset_nostart RC*
|
||||||
set AUTOCNF yes
|
set AUTOCNF yes
|
||||||
else
|
else
|
||||||
set AUTOCNF no
|
set AUTOCNF no
|
||||||
|
|||||||
@@ -52,8 +52,9 @@ PARAM_DEFINE_INT32(SYS_AUTOSTART, 0);
|
|||||||
/**
|
/**
|
||||||
* Automatically configure default values.
|
* Automatically configure default values.
|
||||||
*
|
*
|
||||||
* Set to 1 to set platform-specific parameters to their default
|
* Set to 1 to reset parameters on next system startup (setting defaults).
|
||||||
* values on next system startup.
|
* Platform-specific values are used if available.
|
||||||
|
* RC* parameters are preserved.
|
||||||
*
|
*
|
||||||
* @min 0
|
* @min 0
|
||||||
* @max 1
|
* @max 1
|
||||||
|
|||||||
@@ -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
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -33,7 +33,8 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @file param.c
|
* @file param.c
|
||||||
* @author Lorenz Meier <lm@inf.ethz.ch>
|
* @author Lorenz Meier <lorenz@px4.io>
|
||||||
|
* @author Andreas Antener <andreas@uaventure.com>
|
||||||
*
|
*
|
||||||
* Parameter tool.
|
* 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_import(const char *param_file_name);
|
||||||
static void do_show(const char *search_string);
|
static void do_show(const char *search_string);
|
||||||
static void do_show_print(void *arg, param_t param);
|
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_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_compare(const char* name, char* vals[], unsigned comparisons);
|
||||||
static void do_reset(void);
|
static void do_reset(const char* excludes[], int num_excludes);
|
||||||
static void do_reset_nostart(void);
|
static void do_reset_nostart(const char* excludes[], int num_excludes);
|
||||||
|
|
||||||
int
|
int
|
||||||
param_main(int argc, char *argv[])
|
param_main(int argc, char *argv[])
|
||||||
@@ -151,11 +152,19 @@ param_main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!strcmp(argv[1], "reset")) {
|
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")) {
|
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,9 +461,13 @@ do_compare(const char *name, char *vals[], unsigned comparisons)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
do_reset(void)
|
do_reset(const char* excludes[], int num_excludes)
|
||||||
{
|
{
|
||||||
|
if (num_excludes > 0) {
|
||||||
|
param_reset_excludes(excludes, num_excludes);
|
||||||
|
} else {
|
||||||
param_reset_all();
|
param_reset_all();
|
||||||
|
}
|
||||||
|
|
||||||
if (param_save_default()) {
|
if (param_save_default()) {
|
||||||
warnx("Param export failed.");
|
warnx("Param export failed.");
|
||||||
@@ -466,7 +479,7 @@ do_reset(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
do_reset_nostart(void)
|
do_reset_nostart(const char* excludes[], int num_excludes)
|
||||||
{
|
{
|
||||||
|
|
||||||
int32_t autostart;
|
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_AUTOSTART"), &autostart);
|
||||||
(void)param_get(param_find("SYS_AUTOCONFIG"), &autoconfig);
|
(void)param_get(param_find("SYS_AUTOCONFIG"), &autoconfig);
|
||||||
|
|
||||||
|
if (num_excludes > 0) {
|
||||||
|
param_reset_excludes(excludes, num_excludes);
|
||||||
|
} else {
|
||||||
param_reset_all();
|
param_reset_all();
|
||||||
|
}
|
||||||
|
|
||||||
(void)param_set(param_find("SYS_AUTOSTART"), &autostart);
|
(void)param_set(param_find("SYS_AUTOSTART"), &autostart);
|
||||||
(void)param_set(param_find("SYS_AUTOCONFIG"), &autoconfig);
|
(void)param_set(param_find("SYS_AUTOCONFIG"), &autoconfig);
|
||||||
|
|||||||
Reference in New Issue
Block a user