temperature_calibration: use a define for error code -110

This commit is contained in:
Beat Küng 2017-02-24 10:46:59 +01:00 committed by Lorenz Meier
parent ce8707532e
commit 7cb291aa62
5 changed files with 12 additions and 8 deletions

View File

@ -121,7 +121,7 @@ int TemperatureCalibrationAccel::update_sensor_instance(PerSensorData &data, int
if (hrt_absolute_time() > 10E6) {
// If intial temperature exceeds maximum declare an error condition and exit
if (data.sensor_sample_filt[3] > _max_start_temperature) {
return -110;
return -TC_ERROR_INITIAL_TEMP_TOO_HIGH;
} else {
data.cold_soaked = true;

View File

@ -109,7 +109,7 @@ int TemperatureCalibrationBaro::update_sensor_instance(PerSensorData &data, int
if (hrt_absolute_time() > 10E6) {
// If intial temperature exceeds maximum declare an error condition and exit
if (data.sensor_sample_filt[1] > _max_start_temperature) {
return -110;
return -TC_ERROR_INITIAL_TEMP_TOO_HIGH;
} else {
data.cold_soaked = true;

View File

@ -47,6 +47,9 @@
#define SENSOR_COUNT_MAX 3
#define TC_ERROR_INITIAL_TEMP_TOO_HIGH 110 ///< starting temperature was above the configured allowed temperature
/**
* Base class for temperature calibration types with abstract methods (for all different sensor types)
*/
@ -61,7 +64,8 @@ public:
/**
* check & update new sensor data.
* @return progress in range [0, 100], 110 when finished, <0 on error, -110 if starting temperature is too hot
* @return progress in range [0, 100], 110 when finished, <0 on error,
* -TC_ERROR_INITIAL_TEMP_TOO_HIGH if starting temperature is too hot
*/
virtual int update() = 0;
@ -131,8 +135,8 @@ public:
if (status == -1) {
return -1;
} else if (status == -110) {
return -110;
} else if (status == -TC_ERROR_INITIAL_TEMP_TOO_HIGH) {
return -TC_ERROR_INITIAL_TEMP_TOO_HIGH;
}
num_not_complete += status;
@ -177,7 +181,7 @@ protected:
/**
* update a single sensor instance
* @return 0 when done, 1 not finished yet, -1 for an error that requires the test to be repeated
* @return 0 when done, 1 not finished yet, <0 for an error
*/
virtual int update_sensor_instance(PerSensorData &data, int sensor_sub) = 0;

View File

@ -108,7 +108,7 @@ int TemperatureCalibrationGyro::update_sensor_instance(PerSensorData &data, int
if (hrt_absolute_time() > 10E6) {
// If intial temperature exceeds maximum declare an error condition and exit
if (data.sensor_sample_filt[3] > _max_start_temperature) {
return -110;
return -TC_ERROR_INITIAL_TEMP_TOO_HIGH;
} else {
data.cold_soaked = true;

View File

@ -231,7 +231,7 @@ void TemperatureCalibration::task_main()
for (int i = 0; i < num_calibrators; ++i) {
ret = calibrators[i]->update();
if (ret == -110) {
if (ret == -TC_ERROR_INITIAL_TEMP_TOO_HIGH) {
abort_calibration = true;
PX4_ERR("Calibration won't start - sensor temperature too high");
_force_task_exit = true;