STATIC_INLINE void main_init(void) { // fbw_init fbw_mode = FBW_MODE_FAILSAFE; mcu_init(); actuators_init(); electrical_init(); #if USE_MOTOR_MIXING motor_mixing_init(); #endif radio_control_init(); modules_init(); mcu_int_enable(); intermcu_init(); // register the timers for the periodic functions main_periodic_tid = sys_time_register_timer((1. / PERIODIC_FREQUENCY), NULL); modules_tid = sys_time_register_timer(1. / MODULES_FREQUENCY, NULL); radio_control_tid = sys_time_register_timer((1. / 60.), NULL); electrical_tid = sys_time_register_timer(0.1, NULL); telemetry_tid = sys_time_register_timer((1. / 20.), NULL); }
STATIC_INLINE void main_init(void) { mcu_init(); electrical_init(); stateInit(); #ifndef INTER_MCU_AP actuators_init(); #else intermcu_init(); #endif #if USE_MOTOR_MIXING motor_mixing_init(); #endif #ifndef INTER_MCU_AP radio_control_init(); #endif #if USE_BARO_BOARD baro_init(); #endif #if USE_IMU imu_init(); #endif #if USE_AHRS_ALIGNER ahrs_aligner_init(); #endif #if USE_AHRS ahrs_init(); #endif ins_init(); #if USE_GPS gps_init(); #endif autopilot_init(); modules_init(); settings_init(); mcu_int_enable(); #if DOWNLINK downlink_init(); #endif #ifdef INTER_MCU_AP intermcu_init(); #endif // register the timers for the periodic functions main_periodic_tid = sys_time_register_timer((1. / PERIODIC_FREQUENCY), NULL); modules_tid = sys_time_register_timer(1. / MODULES_FREQUENCY, NULL); radio_control_tid = sys_time_register_timer((1. / 60.), NULL); failsafe_tid = sys_time_register_timer(0.05, NULL); electrical_tid = sys_time_register_timer(0.1, NULL); telemetry_tid = sys_time_register_timer((1. / TELEMETRY_FREQUENCY), NULL); #if USE_BARO_BOARD baro_tid = sys_time_register_timer(1. / BARO_PERIODIC_FREQUENCY, NULL); #endif #if USE_IMU // send body_to_imu from here for now AbiSendMsgBODY_TO_IMU_QUAT(1, orientationGetQuat_f(&imu.body_to_imu)); #endif // Do a failsafe check first failsafe_check(); }
STATIC_INLINE void main_init(void) { mcu_init(); #if defined(PPRZ_TRIG_INT_COMPR_FLASH) pprz_trig_int_init(); #endif electrical_init(); stateInit(); #ifndef INTER_MCU_AP actuators_init(); #else intermcu_init(); #endif #if USE_MOTOR_MIXING motor_mixing_init(); #endif #ifndef INTER_MCU_AP radio_control_init(); #endif #if USE_BARO_BOARD baro_init(); #endif #if USE_AHRS_ALIGNER ahrs_aligner_init(); #endif #if USE_AHRS ahrs_init(); #endif autopilot_init(); modules_init(); /* temporary hack: * Since INS is now a module, LTP_DEF is not yet initialized when autopilot_init is called * This led to the problem that global waypoints were not "localized", * so as a stop-gap measure we localize them all (again) here.. */ waypoints_localize_all(); settings_init(); mcu_int_enable(); #if DOWNLINK downlink_init(); #endif #ifdef INTER_MCU_AP intermcu_init(); #endif // register the timers for the periodic functions main_periodic_tid = sys_time_register_timer((1. / PERIODIC_FREQUENCY), NULL); #if PERIODIC_FREQUENCY != MODULES_FREQUENCY modules_tid = sys_time_register_timer(1. / MODULES_FREQUENCY, NULL); #endif radio_control_tid = sys_time_register_timer((1. / 60.), NULL); failsafe_tid = sys_time_register_timer(0.05, NULL); electrical_tid = sys_time_register_timer(0.1, NULL); telemetry_tid = sys_time_register_timer((1. / TELEMETRY_FREQUENCY), NULL); #if USE_BARO_BOARD baro_tid = sys_time_register_timer(1. / BARO_PERIODIC_FREQUENCY, NULL); #endif #if USE_IMU // send body_to_imu from here for now AbiSendMsgBODY_TO_IMU_QUAT(1, orientationGetQuat_f(&imu.body_to_imu)); #endif // Do a failsafe check first failsafe_check(); }