lib/sensor_calibration: don't save uninitialized priority parameter immediately

This commit is contained in:
Daniel Agar 2021-12-23 15:25:12 -05:00
parent e694fa906b
commit 00eae055ac
3 changed files with 6 additions and 3 deletions

View File

@ -203,9 +203,10 @@ void Accelerometer::ParametersUpdate()
if (_priority != -1) {
PX4_ERR("%s %" PRIu32 " (%" PRId8 ") invalid priority %" PRId32 ", resetting to %" PRId32, SensorString(), _device_id,
_calibration_index, _priority, new_priority);
SetCalibrationParam(SensorString(), "PRIO", _calibration_index, new_priority);
}
SetCalibrationParam(SensorString(), "PRIO", _calibration_index, new_priority);
_priority = new_priority;
}

View File

@ -188,9 +188,10 @@ void Gyroscope::ParametersUpdate()
if (_priority != -1) {
PX4_ERR("%s %" PRIu32 " (%" PRId8 ") invalid priority %" PRId32 ", resetting to %" PRId32, SensorString(), _device_id,
_calibration_index, _priority, new_priority);
SetCalibrationParam(SensorString(), "PRIO", _calibration_index, new_priority);
}
SetCalibrationParam(SensorString(), "PRIO", _calibration_index, new_priority);
_priority = new_priority;
}

View File

@ -188,9 +188,10 @@ void Magnetometer::ParametersUpdate()
if (_priority != -1) {
PX4_ERR("%s %" PRIu32 " (%" PRId8 ") invalid priority %" PRId32 ", resetting to %" PRId32, SensorString(), _device_id,
_calibration_index, _priority, new_priority);
SetCalibrationParam(SensorString(), "PRIO", _calibration_index, new_priority);
}
SetCalibrationParam(SensorString(), "PRIO", _calibration_index, new_priority);
_priority = new_priority;
}