param: remove reset_nostart

Since we have reset_excludes and SYS_AUTOSTART and SYS_AUTOCONFIG
can be excluded like every other parameter.
This commit is contained in:
Matthias Grob 2020-08-26 16:24:30 +02:00
parent ce9954a919
commit c6e2722b8f
4 changed files with 3 additions and 38 deletions

View File

@ -101,7 +101,7 @@ then
set AUTOCNF yes
# Wipe out params except RC*, flight modes, total flight time, accel cal, gyro cal, next flight UUID
param reset_nostart RC* COM_FLTMODE* LND_FLIGHT_T_* TC_* CAL_ACC* CAL_GYRO* COM_FLIGHT_UUID
param reset_all SYS_AUTOSTART SYS_AUTOCONFIG RC* COM_FLTMODE* LND_FLIGHT_T_* TC_* CAL_ACC* CAL_GYRO* COM_FLIGHT_UUID
fi
# multi-instance setup

View File

@ -31,7 +31,7 @@ set PWM_OUT 1234
if [ $AUTOCNF = yes ]
then
# First thing, reset all params to default... EXCEPT THIS LIST
param reset_nostart RC* COM_FLTMODE* LND_FLIGHT_T_* TC_* CAL_ACC* CAL_GYRO* CAL_MAG* SENS_BOARD* EKF2_MAGBIAS*
param reset_all SYS_AUTOSTART SYS_AUTOCONFIG RC* COM_FLTMODE* LND_FLIGHT_T_* TC_* CAL_ACC* CAL_GYRO* CAL_MAG* SENS_BOARD* EKF2_MAGBIAS*
# battery
param set BAT_CAPACITY 2750

View File

@ -180,7 +180,7 @@ else
if param compare SYS_AUTOCONFIG 1
then
# Wipe out params except RC*, flight modes, total flight time, accel cal, gyro cal, next flight UUID
param reset_nostart RC* COM_FLTMODE* LND_FLIGHT_T_* TC_* CAL_ACC* CAL_GYRO* COM_FLIGHT_UUID
param reset_all SYS_AUTOSTART SYS_AUTOCONFIG RC* COM_FLTMODE* LND_FLIGHT_T_* TC_* CAL_ACC* CAL_GYRO* COM_FLIGHT_UUID
fi
set AUTOCNF yes

View File

@ -95,7 +95,6 @@ static int do_compare(const char *name, char *vals[], unsigned comparisons, enum
static int do_reset_all(const char *excludes[], int num_excludes);
static int do_reset_specific(const char *resets[], int num_resets);
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);
static void print_usage()
@ -166,9 +165,6 @@ $ reboot
PRINT_MODULE_USAGE_ARG("<param1> [<param2>]", "Parameter names to reset (wildcard at end allowed)", true);
PRINT_MODULE_USAGE_COMMAND_DESCR("reset_all", "Reset all params to default");
PRINT_MODULE_USAGE_ARG("<exclude1> [<exclude2>]", "Do not reset matching params (wildcard at end allowed)", true);
PRINT_MODULE_USAGE_COMMAND_DESCR("reset_nostart",
"Reset params to default, but keep SYS_AUTOSTART and SYS_AUTOCONFIG");
PRINT_MODULE_USAGE_ARG("<exclude1> [<exclude2>]", "Do not reset matching params (wildcard at end allowed)", true);
PRINT_MODULE_USAGE_COMMAND_DESCR("index", "Show param for a given index");
PRINT_MODULE_USAGE_ARG("<index>", "Index: an integer >= 0", false);
@ -331,15 +327,6 @@ param_main(int argc, char *argv[])
}
}
if (!strcmp(argv[1], "reset_nostart")) {
if (argc >= 3) {
return do_reset_nostart((const char **) &argv[2], argc - 2);
} else {
return do_reset_nostart(nullptr, 0);
}
}
if (!strcmp(argv[1], "index_used")) {
if (argc >= 3) {
return do_show_index(argv[2], true);
@ -836,25 +823,3 @@ do_touch(const char *params[], int num_params)
}
return 0;
}
static int
do_reset_nostart(const char *excludes[], int num_excludes)
{
int32_t autostart;
int32_t autoconfig;
(void)param_get(param_find("SYS_AUTOSTART"), &autostart);
(void)param_get(param_find("SYS_AUTOCONFIG"), &autoconfig);
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);
return 0;
}