From 8eaf7f991881bd34a8b7000384b5536b0a0a110a Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Wed, 18 Mar 2015 04:44:02 +0100 Subject: [PATCH] OP-1793 - Fix enabling condition for baro temp correction --- flight/modules/Sensors/sensors.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/flight/modules/Sensors/sensors.c b/flight/modules/Sensors/sensors.c index c45024d59..623480dd5 100644 --- a/flight/modules/Sensors/sensors.c +++ b/flight/modules/Sensors/sensors.c @@ -591,8 +591,12 @@ static void settingsUpdatedCb(__attribute__((unused)) UAVObjEvent *objEv) RevoSettingsBaroTempCorrectionPolynomialGet(&baroCorrection); RevoSettingsBaroTempCorrectionExtentGet(&baroCorrectionExtent); - baro_temp_correction_enabled = !(baroCorrectionExtent.max - baroCorrectionExtent.min < 0.1f || - (baroCorrection.a < 1e-9f && baroCorrection.b < 1e-9f && baroCorrection.c < 1e-9f && baroCorrection.d < 1e-9f)); + baro_temp_correction_enabled = + (baroCorrectionExtent.max - baroCorrectionExtent.min > 0.1f && + (fabsf(baroCorrection.a) > 1e-9f || + fabsf(baroCorrection.b) > 1e-9f || + fabsf(baroCorrection.c) > 1e-9f || + fabsf(baroCorrection.d) > 1e-9f)); } /** * @}