diff --git a/sw/airborne/firmwares/fixedwing/main_ap.c b/sw/airborne/firmwares/fixedwing/main_ap.c index 248e74abab..36b6d9f51a 100644 --- a/sw/airborne/firmwares/fixedwing/main_ap.c +++ b/sw/airborne/firmwares/fixedwing/main_ap.c @@ -691,6 +691,10 @@ static inline void on_gyro_event( void ) { ahrs_update_accel(); ahrs_update_fw_estimator(); +#ifdef AHRS_TRIGGERED_ATTITUDE_LOOP + new_ins_attitude = 1; +#endif + #else //PERIODIC_FREQUENCY static uint8_t _reduced_propagation_rate = 0; static uint8_t _reduced_correction_rate = 0; @@ -723,8 +727,13 @@ static inline void on_gyro_event( void ) { INT_VECT3_ZERO(acc_avg); ImuScaleAccel(imu); ahrs_update_accel(); - ahrs_update_fw_estimator(); } + + ahrs_update_fw_estimator(); + +#ifdef AHRS_TRIGGERED_ATTITUDE_LOOP + new_ins_attitude = 1; +#endif } #endif //PERIODIC_FREQUENCY @@ -732,10 +741,6 @@ static inline void on_gyro_event( void ) { LED_OFF(AHRS_CPU_LED); #endif -#ifdef AHRS_TRIGGERED_ATTITUDE_LOOP - new_ins_attitude = 1; -#endif - } static inline void on_mag_event(void)