diff --git a/src/modules/events/temperature_calibration/accel.cpp b/src/modules/events/temperature_calibration/accel.cpp index 022429ff62..404d3ee517 100644 --- a/src/modules/events/temperature_calibration/accel.cpp +++ b/src/modules/events/temperature_calibration/accel.cpp @@ -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; diff --git a/src/modules/events/temperature_calibration/baro.cpp b/src/modules/events/temperature_calibration/baro.cpp index 7830f81ac2..220e707112 100644 --- a/src/modules/events/temperature_calibration/baro.cpp +++ b/src/modules/events/temperature_calibration/baro.cpp @@ -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; diff --git a/src/modules/events/temperature_calibration/common.h b/src/modules/events/temperature_calibration/common.h index 7c5aa5c272..8be355eb75 100644 --- a/src/modules/events/temperature_calibration/common.h +++ b/src/modules/events/temperature_calibration/common.h @@ -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; diff --git a/src/modules/events/temperature_calibration/gyro.cpp b/src/modules/events/temperature_calibration/gyro.cpp index 2564794de3..717b2ec469 100644 --- a/src/modules/events/temperature_calibration/gyro.cpp +++ b/src/modules/events/temperature_calibration/gyro.cpp @@ -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; diff --git a/src/modules/events/temperature_calibration/task.cpp b/src/modules/events/temperature_calibration/task.cpp index a237c42b03..f942ca99b7 100644 --- a/src/modules/events/temperature_calibration/task.cpp +++ b/src/modules/events/temperature_calibration/task.cpp @@ -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;