diff --git a/src/modules/events/temperature_calibration/accel.cpp b/src/modules/events/temperature_calibration/accel.cpp index ea31572f24..8740ba8f2a 100644 --- a/src/modules/events/temperature_calibration/accel.cpp +++ b/src/modules/events/temperature_calibration/accel.cpp @@ -78,21 +78,23 @@ void TemperatureCalibrationAccel::reset_calibration() int TemperatureCalibrationAccel::update_sensor_instance(PerSensorData &data, int sensor_sub) { - if (data.hot_soaked) { - // already done - return 0; - } + bool finished = data.hot_soaked; bool updated; orb_check(sensor_sub, &updated); if (!updated) { - return 1; + return finished ? 0 : 1; } sensor_accel_s accel_data; orb_copy(ORB_ID(sensor_accel), sensor_sub, &accel_data); + if (finished) { + // if we're done, return, but we need to return after orb_copy because of poll() + return 0; + } + data.device_id = accel_data.device_id; data.sensor_sample_filt[0] = accel_data.x; diff --git a/src/modules/events/temperature_calibration/baro.cpp b/src/modules/events/temperature_calibration/baro.cpp index bb5cfeb9ac..85ae9ca642 100644 --- a/src/modules/events/temperature_calibration/baro.cpp +++ b/src/modules/events/temperature_calibration/baro.cpp @@ -67,21 +67,23 @@ void TemperatureCalibrationBaro::reset_calibration() int TemperatureCalibrationBaro::update_sensor_instance(PerSensorData &data, int sensor_sub) { - if (data.hot_soaked) { - // already done - return 0; - } + bool finished = data.hot_soaked; bool updated; orb_check(sensor_sub, &updated); if (!updated) { - return 1; + return finished ? 0 : 1; } sensor_baro_s baro_data; orb_copy(ORB_ID(sensor_baro), sensor_sub, &baro_data); + if (finished) { + // if we're done, return, but we need to return after orb_copy because of poll() + return 0; + } + data.device_id = baro_data.device_id; data.sensor_sample_filt[0] = 100.0f * baro_data.pressure; // convert from hPA to Pa diff --git a/src/modules/events/temperature_calibration/gyro.cpp b/src/modules/events/temperature_calibration/gyro.cpp index 390e84f77b..f2dfb44327 100644 --- a/src/modules/events/temperature_calibration/gyro.cpp +++ b/src/modules/events/temperature_calibration/gyro.cpp @@ -67,21 +67,23 @@ void TemperatureCalibrationGyro::reset_calibration() int TemperatureCalibrationGyro::update_sensor_instance(PerSensorData &data, int sensor_sub) { - if (data.hot_soaked) { - // already done - return 0; - } + bool finished = data.hot_soaked; bool updated; orb_check(sensor_sub, &updated); if (!updated) { - return 1; + return finished ? 0 : 1; } sensor_gyro_s gyro_data; orb_copy(ORB_ID(sensor_gyro), sensor_sub, &gyro_data); + if (finished) { + // if we're done, return, but we need to return after orb_copy because of poll() + return 0; + } + data.device_id = gyro_data.device_id; data.sensor_sample_filt[0] = gyro_data.x;