diff options
author | px4dev <px4@purgatory.org> | 2012-10-31 12:59:24 -0700 |
---|---|---|
committer | px4dev <px4@purgatory.org> | 2012-10-31 12:59:24 -0700 |
commit | 8bfceef89cc1fd2422863a99d99039d18a1301bc (patch) | |
tree | 3554d877eb32d57bea1c408cd68b265044c94a67 /apps/systemcmds/param | |
parent | 3c987d63680d153e4d954ad6249d24e5448e2204 (diff) | |
download | px4-firmware-8bfceef89cc1fd2422863a99d99039d18a1301bc.tar.gz px4-firmware-8bfceef89cc1fd2422863a99d99039d18a1301bc.tar.bz2 px4-firmware-8bfceef89cc1fd2422863a99d99039d18a1301bc.zip |
Remove the arbitrary limit on the path to the default parameter file. Add a verb to the param command to set the default parameter file.
Diffstat (limited to 'apps/systemcmds/param')
-rw-r--r-- | apps/systemcmds/param/param.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/apps/systemcmds/param/param.c b/apps/systemcmds/param/param.c index 9cb280933..92313e45a 100644 --- a/apps/systemcmds/param/param.c +++ b/apps/systemcmds/param/param.c @@ -62,8 +62,6 @@ static void do_import(const char* param_file_name); static void do_show(void); static void do_show_print(void *arg, param_t param); -static const char *param_file_name_default = "/eeprom/parameters"; - int param_main(int argc, char *argv[]) { @@ -72,7 +70,7 @@ param_main(int argc, char *argv[]) if (argc >= 3) { do_save(argv[2]); } else { - do_save(param_file_name_default); + do_save(param_get_default_file()); } } @@ -80,7 +78,7 @@ param_main(int argc, char *argv[]) if (argc >= 3) { do_load(argv[2]); } else { - do_load(param_file_name_default); + do_load(param_get_default_file()); } } @@ -88,17 +86,26 @@ param_main(int argc, char *argv[]) if (argc >= 3) { do_import(argv[2]); } else { - do_import(param_file_name_default); + do_import(param_get_default_file()); } } + if (!strcmp(argv[1], "select")) { + if (argc >= 3) { + param_set_default_file(argv[2]); + } else { + param_set_default_file(NULL); + } + warnx("selected parameter file %s", param_get_default_file()); + } + if (!strcmp(argv[1], "show")) { do_show(); } } - - errx(1, "expected a command, try 'load', 'import', 'show' or 'save'\n"); + + errx(1, "expected a command, try 'load', 'import', 'show', 'select' or 'save'"); } static void |