mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-17 00:33:34 +08:00
New param interface for microSD and EEPROM
This commit is contained in:
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user