Browse Source

temperature_calibration: use a define for error code -110

sbg
Beat Küng 8 years ago committed by Lorenz Meier
parent
commit
7cb291aa62
  1. 2
      src/modules/events/temperature_calibration/accel.cpp
  2. 2
      src/modules/events/temperature_calibration/baro.cpp
  3. 12
      src/modules/events/temperature_calibration/common.h
  4. 2
      src/modules/events/temperature_calibration/gyro.cpp
  5. 2
      src/modules/events/temperature_calibration/task.cpp

2
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 (hrt_absolute_time() > 10E6) {
// If intial temperature exceeds maximum declare an error condition and exit // If intial temperature exceeds maximum declare an error condition and exit
if (data.sensor_sample_filt[3] > _max_start_temperature) { if (data.sensor_sample_filt[3] > _max_start_temperature) {
return -110; return -TC_ERROR_INITIAL_TEMP_TOO_HIGH;
} else { } else {
data.cold_soaked = true; data.cold_soaked = true;

2
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 (hrt_absolute_time() > 10E6) {
// If intial temperature exceeds maximum declare an error condition and exit // If intial temperature exceeds maximum declare an error condition and exit
if (data.sensor_sample_filt[1] > _max_start_temperature) { if (data.sensor_sample_filt[1] > _max_start_temperature) {
return -110; return -TC_ERROR_INITIAL_TEMP_TOO_HIGH;
} else { } else {
data.cold_soaked = true; data.cold_soaked = true;

12
src/modules/events/temperature_calibration/common.h

@ -47,6 +47,9 @@
#define SENSOR_COUNT_MAX 3 #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) * Base class for temperature calibration types with abstract methods (for all different sensor types)
*/ */
@ -61,7 +64,8 @@ public:
/** /**
* check & update new sensor data. * 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; virtual int update() = 0;
@ -131,8 +135,8 @@ public:
if (status == -1) { if (status == -1) {
return -1; return -1;
} else if (status == -110) { } else if (status == -TC_ERROR_INITIAL_TEMP_TOO_HIGH) {
return -110; return -TC_ERROR_INITIAL_TEMP_TOO_HIGH;
} }
num_not_complete += status; num_not_complete += status;
@ -177,7 +181,7 @@ protected:
/** /**
* update a single sensor instance * 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; virtual int update_sensor_instance(PerSensorData &data, int sensor_sub) = 0;

2
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 (hrt_absolute_time() > 10E6) {
// If intial temperature exceeds maximum declare an error condition and exit // If intial temperature exceeds maximum declare an error condition and exit
if (data.sensor_sample_filt[3] > _max_start_temperature) { if (data.sensor_sample_filt[3] > _max_start_temperature) {
return -110; return -TC_ERROR_INITIAL_TEMP_TOO_HIGH;
} else { } else {
data.cold_soaked = true; data.cold_soaked = true;

2
src/modules/events/temperature_calibration/task.cpp

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

Loading…
Cancel
Save