aboutsummaryrefslogtreecommitdiff
path: root/apps/commander/commander.c
diff options
context:
space:
mode:
authorLorenz Meier <lm@inf.ethz.ch>2012-10-31 16:31:21 +0100
committerLorenz Meier <lm@inf.ethz.ch>2012-10-31 16:31:21 +0100
commit0ddfd7c75c1f692fe83fcc88f832b42e2b04f0af (patch)
treee574326c207421f7cb8f3bd02d4fb4658823c253 /apps/commander/commander.c
parent8dcde7f8cd72e73ced0ea534a84257ef43210ab6 (diff)
downloadpx4-firmware-0ddfd7c75c1f692fe83fcc88f832b42e2b04f0af.tar.gz
px4-firmware-0ddfd7c75c1f692fe83fcc88f832b42e2b04f0af.tar.bz2
px4-firmware-0ddfd7c75c1f692fe83fcc88f832b42e2b04f0af.zip
New param interface for microSD and EEPROM
Diffstat (limited to 'apps/commander/commander.c')
-rw-r--r--apps/commander/commander.c39
1 files changed, 6 insertions, 33 deletions
diff --git a/apps/commander/commander.c b/apps/commander/commander.c
index e00dc13d2..f2d92dc11 100644
--- a/apps/commander/commander.c
+++ b/apps/commander/commander.c
@@ -268,33 +268,6 @@ void tune_confirm() {
ioctl(buzzer, TONE_SET_ALARM, 3);
}
-static const char *parameter_file = "/eeprom/parameters";
-
-static int pm_save_eeprom(bool only_unsaved)
-{
- /* delete the file in case it exists */
- unlink(parameter_file);
-
- /* create the file */
- int fd = open(parameter_file, O_WRONLY | O_CREAT | O_EXCL);
-
- if (fd < 0) {
- warn("opening '%s' for writing failed", parameter_file);
- return -1;
- }
-
- int result = param_export(fd, only_unsaved);
- close(fd);
-
- if (result != 0) {
- unlink(parameter_file);
- warn("error exporting parameters to '%s'", parameter_file);
- return -2;
- }
-
- return 0;
-}
-
void do_mag_calibration(int status_pub, struct vehicle_status_s *status)
{
/* set to mag calibration mode */
@@ -496,9 +469,9 @@ void do_mag_calibration(int status_pub, struct vehicle_status_s *status)
}
/* auto-save to EEPROM */
- int save_ret = pm_save_eeprom(false);
+ int save_ret = param_save_default();
if(save_ret != 0) {
- warn("WARNING: auto-save of params to EEPROM failed");
+ warn("WARNING: auto-save of params to storage failed");
}
printf("[mag cal]\tscale: %.6f %.6f %.6f\n \toffset: %.6f %.6f %.6f\nradius: %.6f GA\n",
@@ -616,9 +589,9 @@ void do_gyro_calibration(int status_pub, struct vehicle_status_s *status)
close(fd);
/* auto-save to EEPROM */
- int save_ret = pm_save_eeprom(false);
+ int save_ret = param_save_default();
if(save_ret != 0) {
- warn("WARNING: auto-save of params to EEPROM failed");
+ warn("WARNING: auto-save of params to storage failed");
}
// char buf[50];
@@ -736,9 +709,9 @@ void do_accel_calibration(int status_pub, struct vehicle_status_s *status)
close(fd);
/* auto-save to EEPROM */
- int save_ret = pm_save_eeprom(false);
+ int save_ret = param_save_default();
if(save_ret != 0) {
- warn("WARNING: auto-save of params to EEPROM failed");
+ warn("WARNING: auto-save of params to storage failed");
}
//char buf[50];