From fa68c0422d30acf8af477b494e34bc364bdb851e Mon Sep 17 00:00:00 2001 From: James Cotton Date: Sat, 21 Jul 2012 15:44:23 -0500 Subject: [PATCH] Make sure to always compare BiasCorrectedRaw against its enum. Also reversed the order of TRUE,FALSE in the definition to make it safer anyway. --- flight/Modules/Attitude/revolution/attitude.c | 2 +- flight/Modules/Sensors/sensors.c | 2 +- shared/uavobjectdefinition/revocalibration.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/flight/Modules/Attitude/revolution/attitude.c b/flight/Modules/Attitude/revolution/attitude.c index 5ef3dc4d3..31c38150d 100644 --- a/flight/Modules/Attitude/revolution/attitude.c +++ b/flight/Modules/Attitude/revolution/attitude.c @@ -718,7 +718,7 @@ static int32_t updateAttitudeINSGPS(bool first_run, bool outdoor_mode) // Because the sensor module remove the bias we need to add it // back in here so that the INS algorithm can track it correctly float gyros[3] = {gyrosData.x * F_PI / 180.0f, gyrosData.y * F_PI / 180.0f, gyrosData.z * F_PI / 180.0f}; - if (revoCalibration.BiasCorrectedRaw) { + if (revoCalibration.BiasCorrectedRaw = REVOCALIBRATION_BIASCORRECTEDRAW_TRUE) { gyros[0] += gyrosBias.x * F_PI / 180.0f; gyros[1] += gyrosBias.y * F_PI / 180.0f; gyros[2] += gyrosBias.z * F_PI / 180.0f; diff --git a/flight/Modules/Sensors/sensors.c b/flight/Modules/Sensors/sensors.c index 7addc0dad..c5fe3f351 100644 --- a/flight/Modules/Sensors/sensors.c +++ b/flight/Modules/Sensors/sensors.c @@ -453,7 +453,7 @@ static void settingsUpdatedCb(UAVObjEvent * objEv) { AttitudeSettingsData attitudeSettings; AttitudeSettingsGet(&attitudeSettings); - bias_correct_gyro = (attitudeSettings.BiasCorrectGyro == ATTITUDESETTINGS_BIASCORRECTGYRO_TRUE); + bias_correct_gyro = (cal.BiasCorrectedRaw == REVOCALIBRATION_BIASCORRECTEDRAW_TRUE); // Indicates not to expend cycles on rotation if(attitudeSettings.BoardRotation[0] == 0 && attitudeSettings.BoardRotation[1] == 0 && diff --git a/shared/uavobjectdefinition/revocalibration.xml b/shared/uavobjectdefinition/revocalibration.xml index 5a5f4b42e..ee5722b6f 100644 --- a/shared/uavobjectdefinition/revocalibration.xml +++ b/shared/uavobjectdefinition/revocalibration.xml @@ -1,7 +1,7 @@ Settings for the INS to control the algorithm and what is updated - +