diff --git a/sw/airborne/firmwares/rotorcraft/autopilot.c b/sw/airborne/firmwares/rotorcraft/autopilot.c index e55f24fe6d..e13b514f4e 100644 --- a/sw/airborne/firmwares/rotorcraft/autopilot.c +++ b/sw/airborne/firmwares/rotorcraft/autopilot.c @@ -92,7 +92,10 @@ bool_t autopilot_detect_ground_once; #include "subsystems/ahrs.h" static inline int ahrs_is_aligned(void) { - return (ahrs.status == AHRS_RUNNING); + /* FIXME: proper ahrs status management + * maybe use one global AhrsStatus enum again that all implementations need to use + */ + return (DefaultAhrsImpl.status == AHRS_MLKF_RUNNING); } #else PRINT_CONFIG_MSG("Using AUTOPILOT_DISABLE_AHRS_KILL") diff --git a/sw/airborne/firmwares/rotorcraft/main.c b/sw/airborne/firmwares/rotorcraft/main.c index aa464b69ad..c0db954d22 100644 --- a/sw/airborne/firmwares/rotorcraft/main.c +++ b/sw/airborne/firmwares/rotorcraft/main.c @@ -374,11 +374,8 @@ static inline void on_gyro_event( void ) { AbiSendMsgIMU_GYRO_INT32(1, &now_ts, &imu.gyro_prev); #if USE_AHRS_ALIGNER - if (ahrs.status != AHRS_RUNNING) { + if (ahrs_aligner.status != AHRS_ALIGNER_LOCKED) { ahrs_aligner_run(); - if (ahrs_aligner.status == AHRS_ALIGNER_LOCKED) { - ahrs.status = AHRS_RUNNING; - } return; } #endif diff --git a/sw/airborne/subsystems/ahrs.c b/sw/airborne/subsystems/ahrs.c index 91c794b0f7..cb05e487a1 100644 --- a/sw/airborne/subsystems/ahrs.c +++ b/sw/airborne/subsystems/ahrs.c @@ -26,7 +26,6 @@ #include "subsystems/ahrs.h" -#include "subsystems/imu.h" struct Ahrs ahrs; @@ -36,20 +35,17 @@ void ahrs_register_impl(AhrsInit init, AhrsUpdateGps update_gps) ahrs.update_gps = update_gps; ahrs.init(); - - ahrs.status = AHRS_REGISTERED; } void ahrs_init(void) { - ahrs.status = AHRS_UNINIT; ahrs.init = NULL; ahrs.update_gps = NULL; } void ahrs_update_gps(void) { - if (ahrs.update_gps != NULL && ahrs.status == AHRS_RUNNING) { + if (ahrs.update_gps != NULL) { ahrs.update_gps(); } } diff --git a/sw/airborne/subsystems/ahrs.h b/sw/airborne/subsystems/ahrs.h index cae61c1695..8d192febf5 100644 --- a/sw/airborne/subsystems/ahrs.h +++ b/sw/airborne/subsystems/ahrs.h @@ -28,13 +28,6 @@ #define AHRS_H #include "std.h" -#include "math/pprz_algebra_int.h" -#include "math/pprz_algebra_float.h" -#include "math/pprz_orientation_conversion.h" - -#define AHRS_UNINIT 0 -#define AHRS_REGISTERED 1 -#define AHRS_RUNNING 2 /* underlying includes (needed for parameters) */ #ifdef AHRS_TYPE_H @@ -46,8 +39,6 @@ typedef void (*AhrsUpdateGps)(void); /** Attitude and Heading Reference System state */ struct Ahrs { - uint8_t status; ///< status of the AHRS, AHRS_UNINIT or AHRS_RUNNING - /* function pointers to actual implementation, set by ahrs_register_impl */ AhrsInit init; AhrsUpdateGps update_gps;