diff --git a/conf/abi.xml b/conf/abi.xml index ba2e08b6c3..45918ac3a0 100644 --- a/conf/abi.xml +++ b/conf/abi.xml @@ -22,28 +22,28 @@ - + - + - + - - - + + + - + diff --git a/sw/airborne/firmwares/fixedwing/main_ap.c b/sw/airborne/firmwares/fixedwing/main_ap.c index e423567392..9b2aab6c5b 100644 --- a/sw/airborne/firmwares/fixedwing/main_ap.c +++ b/sw/airborne/firmwares/fixedwing/main_ap.c @@ -766,7 +766,7 @@ static inline void on_accel_event(void) imu_scale_accel(&imu); - AbiSendMsgIMU_ACCEL_INT32(1, &now_ts, &imu.accel); + AbiSendMsgIMU_ACCEL_INT32(1, now_ts, &imu.accel); } static inline void on_gyro_event(void) @@ -778,7 +778,7 @@ static inline void on_gyro_event(void) imu_scale_gyro(&imu); - AbiSendMsgIMU_GYRO_INT32(1, &now_ts, &imu.gyro_prev); + AbiSendMsgIMU_GYRO_INT32(1, now_ts, &imu.gyro_prev); #if USE_AHRS_ALIGNER if (ahrs_aligner.status != AHRS_ALIGNER_LOCKED) { @@ -818,7 +818,7 @@ static inline void on_mag_event(void) uint32_t now_ts = get_sys_time_usec(); imu_scale_mag(&imu); - AbiSendMsgIMU_MAG_INT32(1, &now_ts, &imu.mag); + AbiSendMsgIMU_MAG_INT32(1, now_ts, &imu.mag); #endif } diff --git a/sw/airborne/firmwares/rotorcraft/main.c b/sw/airborne/firmwares/rotorcraft/main.c index 73bf1245ae..20493daac9 100644 --- a/sw/airborne/firmwares/rotorcraft/main.c +++ b/sw/airborne/firmwares/rotorcraft/main.c @@ -362,7 +362,7 @@ static inline void on_accel_event( void ) { imu_scale_accel(&imu); - AbiSendMsgIMU_ACCEL_INT32(1, &now_ts, &imu.accel); + AbiSendMsgIMU_ACCEL_INT32(1, now_ts, &imu.accel); } static inline void on_gyro_event( void ) { @@ -371,7 +371,7 @@ static inline void on_gyro_event( void ) { imu_scale_gyro(&imu); - AbiSendMsgIMU_GYRO_INT32(1, &now_ts, &imu.gyro_prev); + AbiSendMsgIMU_GYRO_INT32(1, now_ts, &imu.gyro_prev); #if USE_AHRS_ALIGNER if (ahrs_aligner.status != AHRS_ALIGNER_LOCKED) { @@ -420,7 +420,7 @@ static inline void on_mag_event(void) // current timestamp uint32_t now_ts = get_sys_time_usec(); - AbiSendMsgIMU_MAG_INT32(1, &now_ts, &imu.mag); + AbiSendMsgIMU_MAG_INT32(1, now_ts, &imu.mag); #ifdef USE_VEHICLE_INTERFACE vi_notify_mag_available(); diff --git a/sw/airborne/modules/sensors/mag_hmc58xx.c b/sw/airborne/modules/sensors/mag_hmc58xx.c index a59ec5f3ab..f3ed0cd50c 100644 --- a/sw/airborne/modules/sensors/mag_hmc58xx.c +++ b/sw/airborne/modules/sensors/mag_hmc58xx.c @@ -78,7 +78,7 @@ void mag_hmc58xx_module_event(void) // scale vector imu_scale_mag(&imu); - AbiSendMsgIMU_MAG_INT32(MAG_HMC58XX_SENDER_ID, &now_ts, &imu.mag); + AbiSendMsgIMU_MAG_INT32(MAG_HMC58XX_SENDER_ID, now_ts, &imu.mag); #endif #if MODULE_HMC58XX_SYNC_SEND mag_hmc58xx_report(); diff --git a/sw/airborne/subsystems/ahrs/ahrs_aligner.c b/sw/airborne/subsystems/ahrs/ahrs_aligner.c index 502e806a54..d0a7c2ab6c 100644 --- a/sw/airborne/subsystems/ahrs/ahrs_aligner.c +++ b/sw/airborne/subsystems/ahrs/ahrs_aligner.c @@ -136,7 +136,7 @@ void ahrs_aligner_run(void) LED_ON(AHRS_ALIGNER_LED); #endif uint32_t now_ts = get_sys_time_usec(); - AbiSendMsgIMU_LOWPASSED(ABI_BROADCAST, &now_ts, &ahrs_aligner.lp_gyro, + AbiSendMsgIMU_LOWPASSED(ABI_BROADCAST, now_ts, &ahrs_aligner.lp_gyro, &ahrs_aligner.lp_accel, &ahrs_aligner.lp_mag); } } diff --git a/sw/airborne/subsystems/ahrs/ahrs_float_cmpl_wrapper.c b/sw/airborne/subsystems/ahrs/ahrs_float_cmpl_wrapper.c index 40a6d37a0f..175dd79226 100644 --- a/sw/airborne/subsystems/ahrs/ahrs_float_cmpl_wrapper.c +++ b/sw/airborne/subsystems/ahrs/ahrs_float_cmpl_wrapper.c @@ -69,8 +69,8 @@ static abi_event aligner_ev; static abi_event body_to_imu_ev; -static void gyro_cb(uint8_t __attribute__((unused)) sender_id, const uint32_t *stamp, - const struct Int32Rates *gyro) +static void gyro_cb(uint8_t __attribute__((unused)) sender_id, uint32_t stamp, + struct Int32Rates *gyro) { #if USE_AUTO_AHRS_FREQ || !defined(AHRS_PROPAGATE_FREQUENCY) PRINT_CONFIG_MSG("Calculating dt for AHRS_FC propagation.") @@ -78,31 +78,31 @@ static void gyro_cb(uint8_t __attribute__((unused)) sender_id, const uint32_t *s static uint32_t last_stamp = 0; if (last_stamp > 0 && ahrs_fc.is_aligned) { - float dt = (float)(*stamp - last_stamp) * 1e-6; - ahrs_fc_propagate((struct Int32Rates *)gyro, dt); + float dt = (float)(stamp - last_stamp) * 1e-6; + ahrs_fc_propagate(gyro, dt); } - last_stamp = *stamp; + last_stamp = stamp; #else PRINT_CONFIG_MSG("Using fixed AHRS_PROPAGATE_FREQUENCY for AHRS_FC propagation.") PRINT_CONFIG_VAR(AHRS_PROPAGATE_FREQUENCY) if (ahrs_fc.status == AHRS_FC_RUNNING) { const float dt = 1. / (AHRS_PROPAGATE_FREQUENCY); - ahrs_fc_propagate((struct Int32Rates *)gyro, dt); + ahrs_fc_propagate(gyro, dt); } #endif } -static void accel_cb(uint8_t __attribute__((unused)) sender_id, const uint32_t *stamp, - const struct Int32Vect3 *accel) +static void accel_cb(uint8_t __attribute__((unused)) sender_id, uint32_t stamp, + struct Int32Vect3 *accel) { #if USE_AUTO_AHRS_FREQ || !defined(AHRS_CORRECT_FREQUENCY) PRINT_CONFIG_MSG("Calculating dt for AHRS float_cmpl accel update.") static uint32_t last_stamp = 0; if (last_stamp > 0 && ahrs_fc.is_aligned) { - float dt = (float)(*stamp - last_stamp) * 1e-6; + float dt = (float)(stamp - last_stamp) * 1e-6; ahrs_fc_update_accel((struct Int32Vect3 *)accel, dt); } - last_stamp = *stamp; + last_stamp = stamp; #else PRINT_CONFIG_MSG("Using fixed AHRS_CORRECT_FREQUENCY for AHRS float_cmpl accel update.") PRINT_CONFIG_VAR(AHRS_CORRECT_FREQUENCY) @@ -113,42 +113,41 @@ static void accel_cb(uint8_t __attribute__((unused)) sender_id, const uint32_t * #endif } -static void mag_cb(uint8_t __attribute__((unused)) sender_id, const uint32_t *stamp, - const struct Int32Vect3 *mag) +static void mag_cb(uint8_t __attribute__((unused)) sender_id, uint32_t stamp, + struct Int32Vect3 *mag) { #if USE_AUTO_AHRS_FREQ || !defined(AHRS_MAG_CORRECT_FREQUENCY) PRINT_CONFIG_MSG("Calculating dt for AHRS float_cmpl mag update.") static uint32_t last_stamp = 0; if (last_stamp > 0 && ahrs_fc.is_aligned) { - float dt = (float)(*stamp - last_stamp) * 1e-6; - ahrs_fc_update_mag((struct Int32Vect3 *)mag, dt); + float dt = (float)(stamp - last_stamp) * 1e-6; + ahrs_fc_update_mag(mag, dt); } - last_stamp = *stamp; + last_stamp = stamp; #else PRINT_CONFIG_MSG("Using fixed AHRS_MAG_CORRECT_FREQUENCY for AHRS float_cmpl mag update.") PRINT_CONFIG_VAR(AHRS_MAG_CORRECT_FREQUENCY) if (ahrs_fc.is_aligned) { const float dt = 1. / (AHRS_MAG_CORRECT_FREQUENCY); - ahrs_fc_update_mag((struct Int32Vect3 *)mag, dt); + ahrs_fc_update_mag(mag, dt); } #endif } static void aligner_cb(uint8_t __attribute__((unused)) sender_id, - const uint32_t *stamp __attribute__((unused)), - const struct Int32Rates *lp_gyro, const struct Int32Vect3 *lp_accel, - const struct Int32Vect3 *lp_mag) + uint32_t stamp __attribute__((unused)), + struct Int32Rates *lp_gyro, struct Int32Vect3 *lp_accel, + struct Int32Vect3 *lp_mag) { if (!ahrs_fc.is_aligned) { - ahrs_fc_align((struct Int32Rates *)lp_gyro, (struct Int32Vect3 *)lp_accel, - (struct Int32Vect3 *)lp_mag); + ahrs_fc_align(lp_gyro, lp_accel, lp_mag); } } static void body_to_imu_cb(uint8_t sender_id __attribute__((unused)), - const struct FloatQuat *q_b2i_f) + struct FloatQuat *q_b2i_f) { - ahrs_fc_set_body_to_imu_quat((struct FloatQuat *)q_b2i_f); + ahrs_fc_set_body_to_imu_quat(q_b2i_f); } void ahrs_fc_register(void) diff --git a/sw/airborne/subsystems/ahrs/ahrs_float_dcm_wrapper.c b/sw/airborne/subsystems/ahrs/ahrs_float_dcm_wrapper.c index 97e052d85d..eb0c35daae 100644 --- a/sw/airborne/subsystems/ahrs/ahrs_float_dcm_wrapper.c +++ b/sw/airborne/subsystems/ahrs/ahrs_float_dcm_wrapper.c @@ -42,61 +42,60 @@ static abi_event aligner_ev; static abi_event body_to_imu_ev; -static void gyro_cb(uint8_t __attribute__((unused)) sender_id, const uint32_t *stamp, - const struct Int32Rates *gyro) +static void gyro_cb(uint8_t __attribute__((unused)) sender_id, uint32_t stamp, + struct Int32Rates *gyro) { #if USE_AUTO_AHRS_FREQ || !defined(AHRS_PROPAGATE_FREQUENCY) PRINT_CONFIG_MSG("Calculating dt for AHRS dcm propagation.") /* timestamp in usec when last callback was received */ static uint32_t last_stamp = 0; if (last_stamp > 0 && ahrs_dcm.is_aligned) { - float dt = (float)(*stamp - last_stamp) * 1e-6; - ahrs_dcm_propagate((struct Int32Rates *)gyro, dt); + float dt = (float)(stamp - last_stamp) * 1e-6; + ahrs_dcm_propagate(gyro, dt); } - last_stamp = *stamp; + last_stamp = stamp; #else PRINT_CONFIG_MSG("Using fixed AHRS_PROPAGATE_FREQUENCY for AHRS dcm propagation.") PRINT_CONFIG_VAR(AHRS_PROPAGATE_FREQUENCY) if (ahrs_dcm.is_aligned) { const float dt = 1. / (AHRS_PROPAGATE_FREQUENCY); - ahrs_dcm_propagate((struct Int32Rates *)gyro, dt); + ahrs_dcm_propagate(gyro, dt); } #endif } static void accel_cb(uint8_t sender_id __attribute__((unused)), - const uint32_t *stamp __attribute__((unused)), - const struct Int32Vect3 *accel) + uint32_t stamp __attribute__((unused)), + struct Int32Vect3 *accel) { if (ahrs_dcm.is_aligned) { - ahrs_dcm_update_accel((struct Int32Vect3 *)accel); + ahrs_dcm_update_accel(accel); } } static void mag_cb(uint8_t sender_id __attribute__((unused)), - const uint32_t *stamp __attribute__((unused)), - const struct Int32Vect3 *mag) + uint32_t stamp __attribute__((unused)), + struct Int32Vect3 *mag) { if (ahrs_dcm.is_aligned) { - ahrs_dcm_update_mag((struct Int32Vect3 *)mag); + ahrs_dcm_update_mag(mag); } } static void aligner_cb(uint8_t __attribute__((unused)) sender_id, - const uint32_t *stamp __attribute__((unused)), - const struct Int32Rates *lp_gyro, const struct Int32Vect3 *lp_accel, - const struct Int32Vect3 *lp_mag) + uint32_t stamp __attribute__((unused)), + struct Int32Rates *lp_gyro, struct Int32Vect3 *lp_accel, + struct Int32Vect3 *lp_mag) { if (!ahrs_dcm.is_aligned) { - ahrs_dcm_align((struct Int32Rates *)lp_gyro, (struct Int32Vect3 *)lp_accel, - (struct Int32Vect3 *)lp_mag); + ahrs_dcm_align(lp_gyro, lp_accel, lp_mag); } } static void body_to_imu_cb(uint8_t sender_id __attribute__((unused)), - const struct FloatQuat *q_b2i_f) + struct FloatQuat *q_b2i_f) { - ahrs_dcm_set_body_to_imu_quat((struct FloatQuat *)q_b2i_f); + ahrs_dcm_set_body_to_imu_quat(q_b2i_f); } void ahrs_dcm_register(void) diff --git a/sw/airborne/subsystems/ahrs/ahrs_float_mlkf_wrapper.c b/sw/airborne/subsystems/ahrs/ahrs_float_mlkf_wrapper.c index 081606ba49..1d1714f6b4 100644 --- a/sw/airborne/subsystems/ahrs/ahrs_float_mlkf_wrapper.c +++ b/sw/airborne/subsystems/ahrs/ahrs_float_mlkf_wrapper.c @@ -53,8 +53,8 @@ static abi_event aligner_ev; static abi_event body_to_imu_ev; -static void gyro_cb(uint8_t __attribute__((unused)) sender_id, const uint32_t *stamp, - const struct Int32Rates *gyro) +static void gyro_cb(uint8_t __attribute__((unused)) sender_id, uint32_t stamp, + struct Int32Rates *gyro) { #if USE_AUTO_AHRS_FREQ || !defined(AHRS_PROPAGATE_FREQUENCY) PRINT_CONFIG_MSG("Calculating dt for AHRS_MLKF propagation.") @@ -62,53 +62,52 @@ static void gyro_cb(uint8_t __attribute__((unused)) sender_id, const uint32_t *s static uint32_t last_stamp = 0; if (last_stamp > 0 && ahrs_mlkf.is_aligned) { - float dt = (float)(*stamp - last_stamp) * 1e-6; - ahrs_mlkf_propagate((struct Int32Rates *)gyro, dt); + float dt = (float)(stamp - last_stamp) * 1e-6; + ahrs_mlkf_propagate(gyro, dt); } - last_stamp = *stamp; + last_stamp = stamp; #else PRINT_CONFIG_MSG("Using fixed AHRS_PROPAGATE_FREQUENCY for AHRS_MLKF propagation.") PRINT_CONFIG_VAR(AHRS_PROPAGATE_FREQUENCY) if (ahrs_mlkf.status == AHRS_MLKF_RUNNING) { const float dt = 1. / (AHRS_PROPAGATE_FREQUENCY); - ahrs_mlkf_propagate((struct Int32Rates *)gyro, dt); + ahrs_mlkf_propagate(gyro, dt); } #endif } static void accel_cb(uint8_t sender_id __attribute__((unused)), - const uint32_t *stamp __attribute__((unused)), - const struct Int32Vect3 *accel) + uint32_t stamp __attribute__((unused)), + struct Int32Vect3 *accel) { if (ahrs_mlkf.is_aligned) { - ahrs_mlkf_update_accel((struct Int32Vect3 *)accel); + ahrs_mlkf_update_accel(accel); } } static void mag_cb(uint8_t sender_id __attribute__((unused)), - const uint32_t *stamp __attribute__((unused)), - const struct Int32Vect3 *mag) + uint32_t stamp __attribute__((unused)), + struct Int32Vect3 *mag) { if (ahrs_mlkf.is_aligned) { - ahrs_mlkf_update_mag((struct Int32Vect3 *)mag); + ahrs_mlkf_update_mag(mag); } } static void aligner_cb(uint8_t __attribute__((unused)) sender_id, - const uint32_t *stamp __attribute__((unused)), - const struct Int32Rates *lp_gyro, const struct Int32Vect3 *lp_accel, - const struct Int32Vect3 *lp_mag) + uint32_t stamp __attribute__((unused)), + struct Int32Rates *lp_gyro, struct Int32Vect3 *lp_accel, + struct Int32Vect3 *lp_mag) { if (!ahrs_mlkf.is_aligned) { - ahrs_mlkf_align((struct Int32Rates *)lp_gyro, (struct Int32Vect3 *)lp_accel, - (struct Int32Vect3 *)lp_mag); + ahrs_mlkf_align(lp_accel, lp_accel, lp_mag); } } static void body_to_imu_cb(uint8_t sender_id __attribute__((unused)), - const struct FloatQuat *q_b2i_f) + struct FloatQuat *q_b2i_f) { - ahrs_mlkf_set_body_to_imu_quat((struct FloatQuat *)q_b2i_f); + ahrs_mlkf_set_body_to_imu_quat(q_b2i_f); } void ahrs_mlkf_register(void) diff --git a/sw/airborne/subsystems/ahrs/ahrs_infrared.c b/sw/airborne/subsystems/ahrs/ahrs_infrared.c index 1d4034a83b..a2cf3a6fe9 100644 --- a/sw/airborne/subsystems/ahrs/ahrs_infrared.c +++ b/sw/airborne/subsystems/ahrs/ahrs_infrared.c @@ -51,10 +51,10 @@ float heading; static abi_event gyro_ev; static void gyro_cb(uint8_t sender_id __attribute__((unused)), - const uint32_t *stamp __attribute__((unused)), - const struct Int32Rates *gyro) + uint32_t stamp __attribute__((unused)), + struct Int32Rates *gyro) { - stateSetBodyRates_i((struct Int32Rates *)gyro); + stateSetBodyRates_i(gyro); } diff --git a/sw/airborne/subsystems/ahrs/ahrs_int_cmpl_euler_wrapper.c b/sw/airborne/subsystems/ahrs/ahrs_int_cmpl_euler_wrapper.c index 4e38277e81..9937e44db8 100644 --- a/sw/airborne/subsystems/ahrs/ahrs_int_cmpl_euler_wrapper.c +++ b/sw/airborne/subsystems/ahrs/ahrs_int_cmpl_euler_wrapper.c @@ -85,48 +85,47 @@ static abi_event body_to_imu_ev; static void gyro_cb(uint8_t sender_id __attribute__((unused)), - const uint32_t *stamp __attribute__((unused)), - const struct Int32Rates *gyro) + uint32_t stamp __attribute__((unused)), + struct Int32Rates *gyro) { if (ahrs_ice.is_aligned) { - ahrs_ice_propagate((struct Int32Rates *)gyro); + ahrs_ice_propagate(gyro); } } static void accel_cb(uint8_t sender_id __attribute__((unused)), - const uint32_t *stamp __attribute__((unused)), - const struct Int32Vect3 *accel) + uint32_t stamp __attribute__((unused)), + struct Int32Vect3 *accel) { if (ahrs_ice.is_aligned) { - ahrs_ice_update_accel((struct Int32Vect3 *)accel); + ahrs_ice_update_accel(accel); } } static void mag_cb(uint8_t sender_id __attribute__((unused)), - const uint32_t *stamp __attribute__((unused)), - const struct Int32Vect3 *mag) + uint32_t stamp __attribute__((unused)), + struct Int32Vect3 *mag) { if (ahrs_ice.is_aligned) { - ahrs_ice_update_mag((struct Int32Vect3 *)mag); + ahrs_ice_update_mag(mag); } } static void aligner_cb(uint8_t __attribute__((unused)) sender_id, - const uint32_t *stamp __attribute__((unused)), - const struct Int32Rates *lp_gyro, const struct Int32Vect3 *lp_accel, - const struct Int32Vect3 *lp_mag) + uint32_t stamp __attribute__((unused)), + struct Int32Rates *lp_gyro, struct Int32Vect3 *lp_accel, + struct Int32Vect3 *lp_mag) { if (!ahrs_ice.is_aligned) { - ahrs_ice_align((struct Int32Rates *)lp_gyro, (struct Int32Vect3 *)lp_accel, - (struct Int32Vect3 *)lp_mag); + ahrs_ice_align(lp_gyro, lp_accel, lp_mag); } } static void body_to_imu_cb(uint8_t sender_id __attribute__((unused)), - const struct FloatQuat *q_b2i_f) + struct FloatQuat *q_b2i_f) { - ahrs_ice_set_body_to_imu_quat((struct FloatQuat *)q_b2i_f); + ahrs_ice_set_body_to_imu_quat(q_b2i_f); } void ahrs_ice_register(void) diff --git a/sw/airborne/subsystems/ahrs/ahrs_int_cmpl_quat_wrapper.c b/sw/airborne/subsystems/ahrs/ahrs_int_cmpl_quat_wrapper.c index 6d2c69d2d5..015f1053fd 100644 --- a/sw/airborne/subsystems/ahrs/ahrs_int_cmpl_quat_wrapper.c +++ b/sw/airborne/subsystems/ahrs/ahrs_int_cmpl_quat_wrapper.c @@ -91,8 +91,8 @@ static abi_event aligner_ev; static abi_event body_to_imu_ev; -static void gyro_cb(uint8_t __attribute__((unused)) sender_id, const uint32_t *stamp, - const struct Int32Rates *gyro) +static void gyro_cb(uint8_t __attribute__((unused)) sender_id, uint32_t stamp, + struct Int32Rates *gyro) { #if USE_AUTO_AHRS_FREQ || !defined(AHRS_PROPAGATE_FREQUENCY) PRINT_CONFIG_MSG("Calculating dt for AHRS_ICQ propagation.") @@ -100,77 +100,76 @@ static void gyro_cb(uint8_t __attribute__((unused)) sender_id, const uint32_t *s static uint32_t last_stamp = 0; if (last_stamp > 0 && ahrs_icq.is_aligned) { - float dt = (float)(*stamp - last_stamp) * 1e-6; - ahrs_icq_propagate((struct Int32Rates *)gyro, dt); + float dt = (float)(stamp - last_stamp) * 1e-6; + ahrs_icq_propagate(gyro, dt); } - last_stamp = *stamp; + last_stamp = stamp; #else PRINT_CONFIG_MSG("Using fixed AHRS_PROPAGATE_FREQUENCY for AHRS_ICQ propagation.") PRINT_CONFIG_VAR(AHRS_PROPAGATE_FREQUENCY) if (ahrs_icq.status == AHRS_ICQ_RUNNING) { const float dt = 1. / (AHRS_PROPAGATE_FREQUENCY); - ahrs_icq_propagate((struct Int32Rates *)gyro, dt); + ahrs_icq_propagate(gyro, dt); } #endif } -static void accel_cb(uint8_t __attribute__((unused)) sender_id, const uint32_t *stamp, - const struct Int32Vect3 *accel) +static void accel_cb(uint8_t __attribute__((unused)) sender_id, uint32_t stamp, + struct Int32Vect3 *accel) { #if USE_AUTO_AHRS_FREQ || !defined(AHRS_CORRECT_FREQUENCY) PRINT_CONFIG_MSG("Calculating dt for AHRS int_cmpl_quat accel update.") static uint32_t last_stamp = 0; if (last_stamp > 0 && ahrs_icq.is_aligned) { - float dt = (float)(*stamp - last_stamp) * 1e-6; - ahrs_icq_update_accel((struct Int32Vect3 *)accel, dt); + float dt = (float)(stamp - last_stamp) * 1e-6; + ahrs_icq_update_accel(accel, dt); } - last_stamp = *stamp; + last_stamp = stamp; #else PRINT_CONFIG_MSG("Using fixed AHRS_CORRECT_FREQUENCY for AHRS int_cmpl_quat accel update.") PRINT_CONFIG_VAR(AHRS_CORRECT_FREQUENCY) if (ahrs_icq.is_aligned) { const float dt = 1. / (AHRS_CORRECT_FREQUENCY); - ahrs_icq_update_accel((struct Int32Vect3 *)accel, dt); + ahrs_icq_update_accel(accel, dt); } #endif } -static void mag_cb(uint8_t __attribute__((unused)) sender_id, const uint32_t *stamp, - const struct Int32Vect3 *mag) +static void mag_cb(uint8_t __attribute__((unused)) sender_id, uint32_t stamp, + struct Int32Vect3 *mag) { #if USE_AUTO_AHRS_FREQ || !defined(AHRS_MAG_CORRECT_FREQUENCY) PRINT_CONFIG_MSG("Calculating dt for AHRS int_cmpl_quat mag update.") static uint32_t last_stamp = 0; if (last_stamp > 0 && ahrs_icq.is_aligned) { - float dt = (float)(*stamp - last_stamp) * 1e-6; - ahrs_icq_update_mag((struct Int32Vect3 *)mag, dt); + float dt = (float)(stamp - last_stamp) * 1e-6; + ahrs_icq_update_mag(mag, dt); } - last_stamp = *stamp; + last_stamp = stamp; #else PRINT_CONFIG_MSG("Using fixed AHRS_MAG_CORRECT_FREQUENCY for AHRS int_cmpl_quat mag update.") PRINT_CONFIG_VAR(AHRS_MAG_CORRECT_FREQUENCY) if (ahrs_icq.is_aligned) { const float dt = 1. / (AHRS_MAG_CORRECT_FREQUENCY); - ahrs_icq_update_mag((struct Int32Vect3 *)mag, dt); + ahrs_icq_update_mag(mag, dt); } #endif } static void aligner_cb(uint8_t __attribute__((unused)) sender_id, - const uint32_t *stamp __attribute__((unused)), - const struct Int32Rates *lp_gyro, const struct Int32Vect3 *lp_accel, - const struct Int32Vect3 *lp_mag) + uint32_t stamp __attribute__((unused)), + struct Int32Rates *lp_gyro, struct Int32Vect3 *lp_accel, + struct Int32Vect3 *lp_mag) { if (!ahrs_icq.is_aligned) { - ahrs_icq_align((struct Int32Rates *)lp_gyro, (struct Int32Vect3 *)lp_accel, - (struct Int32Vect3 *)lp_mag); + ahrs_icq_align(lp_gyro, lp_accel, lp_mag); } } static void body_to_imu_cb(uint8_t sender_id __attribute__((unused)), - const struct FloatQuat *q_b2i_f) + struct FloatQuat *q_b2i_f) { - ahrs_icq_set_body_to_imu_quat((struct FloatQuat *)q_b2i_f); + ahrs_icq_set_body_to_imu_quat(q_b2i_f); } void ahrs_icq_register(void) diff --git a/sw/airborne/subsystems/ins/ins_float_invariant.c b/sw/airborne/subsystems/ins/ins_float_invariant.c index ccb64a5984..63b9f515e0 100644 --- a/sw/airborne/subsystems/ins/ins_float_invariant.c +++ b/sw/airborne/subsystems/ins/ins_float_invariant.c @@ -186,14 +186,14 @@ static void baro_cb(uint8_t sender_id, float pressure); #define INS_MAG_ID ABI_BROADCAST #endif static abi_event mag_ev; -static void mag_cb(uint8_t __attribute__((unused)) sender_id, const uint32_t *stamp, - const struct Int32Vect3 *mag); +static void mag_cb(uint8_t __attribute__((unused)) sender_id, uint32_t stamp, + struct Int32Vect3 *mag); static abi_event aligner_ev; static void aligner_cb(uint8_t __attribute__((unused)) sender_id, - const uint32_t *stamp __attribute__((unused)), - const struct Int32Rates *lp_gyro, const struct Int32Vect3 *lp_accel, - const struct Int32Vect3 *lp_mag); + uint32_t stamp __attribute__((unused)), + struct Int32Rates *lp_gyro, struct Int32Vect3 *lp_accel, + struct Int32Vect3 *lp_mag); /* gps */ @@ -756,21 +756,20 @@ void ins_propagate(float dt) } static void mag_cb(uint8_t sender_id __attribute__((unused)), - const uint32_t *stamp __attribute__((unused)), - const struct Int32Vect3 *mag) + uint32_t stamp __attribute__((unused)), + struct Int32Vect3 *mag) { if (ins_impl.is_aligned) { - ins_float_invariant_update_mag((struct Int32Vect3 *)mag); + ins_float_invariant_update_mag(mag); } } static void aligner_cb(uint8_t __attribute__((unused)) sender_id, - const uint32_t *stamp __attribute__((unused)), - const struct Int32Rates *lp_gyro, const struct Int32Vect3 *lp_accel, - const struct Int32Vect3 *lp_mag) + uint32_t stamp __attribute__((unused)), + struct Int32Rates *lp_gyro, struct Int32Vect3 *lp_accel, + struct Int32Vect3 *lp_mag) { if (!ins_impl.is_aligned) { - ins_float_invariant_align((struct Int32Rates *)lp_gyro, (struct Int32Vect3 *)lp_accel, - (struct Int32Vect3 *)lp_mag); + ins_float_invariant_align(lp_gyro, lp_accel, lp_mag); } } diff --git a/sw/airborne/test/subsystems/test_ahrs.c b/sw/airborne/test/subsystems/test_ahrs.c index bd80c96c1e..62ca08e2f4 100644 --- a/sw/airborne/test/subsystems/test_ahrs.c +++ b/sw/airborne/test/subsystems/test_ahrs.c @@ -107,7 +107,7 @@ static inline void on_gyro_event(void) imu_scale_gyro(&imu); - AbiSendMsgIMU_GYRO_INT32(1, &now_ts, &imu.gyro_prev); + AbiSendMsgIMU_GYRO_INT32(1, now_ts, &imu.gyro_prev); #if USE_AHRS_ALIGNER if (ahrs_aligner.status != AHRS_ALIGNER_LOCKED) { @@ -124,7 +124,7 @@ static inline void on_accel_event(void) imu_scale_accel(&imu); - AbiSendMsgIMU_ACCEL_INT32(1, &now_ts, &imu.accel); + AbiSendMsgIMU_ACCEL_INT32(1, now_ts, &imu.accel); } static inline void on_mag_event(void) @@ -134,7 +134,7 @@ static inline void on_mag_event(void) imu_scale_mag(&imu); - AbiSendMsgIMU_MAG_INT32(1, &now_ts, &imu.mag); + AbiSendMsgIMU_MAG_INT32(1, now_ts, &imu.mag); }