diff --git a/sw/airborne/subsystems/ahrs/ahrs_float_dcm.c b/sw/airborne/subsystems/ahrs/ahrs_float_dcm.c index 1cca106105..84634fed0b 100644 --- a/sw/airborne/subsystems/ahrs/ahrs_float_dcm.c +++ b/sw/airborne/subsystems/ahrs/ahrs_float_dcm.c @@ -303,10 +303,10 @@ void Drift_correction(void) //*****YAW*************** -#if USE_MAGNETOMETER==1 +#ifdef USE_MAGNETOMETER // We make the gyro YAW drift correction based on compass magnetic heading - mag_heading_x = cos(MAG_Heading); - mag_heading_y = sin(MAG_Heading); + float mag_heading_x = cos(MAG_Heading); + float mag_heading_y = sin(MAG_Heading); errorCourse=(DCM_Matrix[0][0]*mag_heading_y) - (DCM_Matrix[1][0]*mag_heading_x); //Calculating YAW error Vector_Scale(errorYaw,&DCM_Matrix[2][0],errorCourse); //Applys the yaw correction to the XYZ rotation of the aircraft, depeding the position. diff --git a/sw/airborne/subsystems/ahrs/ahrs_float_dcm.h b/sw/airborne/subsystems/ahrs/ahrs_float_dcm.h index e7a56bec67..c6de59991b 100644 --- a/sw/airborne/subsystems/ahrs/ahrs_float_dcm.h +++ b/sw/airborne/subsystems/ahrs/ahrs_float_dcm.h @@ -65,8 +65,6 @@ void ahrs_update_fw_estimator(void); // Mode 1 = DCM integration with Kp and Ki // Mode 2 = direct accelerometer -> euler -#define MAGNETOMETER 1 -extern float MAG_Heading; #define PERFORMANCE_REPORTING 0 #if PERFORMANCE_REPORTING == 1