/************* PERIODIC ******************************************************/ void periodic_task_fbw( void ) { #ifdef RADIO_CONTROL radio_control_periodic_task(); if (fbw_mode == FBW_MODE_MANUAL && radio_control.status == RC_REALLY_LOST) { #ifdef OUTBACK_CHALLENGE_DANGEROUS_RULE_RC_LOST_NO_AP #warning WARNING DANGER: OUTBACK_CHALLENGE RULE RC_LOST_NO_AP defined. If you loose RC you will NOT go to automatically go to AUTO2 Anymore!! set_failsafe_mode(); #else fbw_mode = FBW_MODE_AUTO; #endif } #endif #ifdef INTER_MCU inter_mcu_periodic_task(); if (fbw_mode == FBW_MODE_AUTO && !ap_ok) { set_failsafe_mode(); } #endif #ifdef MCU_UART_LINK inter_mcu_fill_fbw_state(); link_mcu_periodic_task(); #endif #ifdef DOWNLINK fbw_downlink_periodic_task(); #endif }
/************* PERIODIC ******************************************************/ void periodic_task_fbw( void ) { static uint8_t _10Hz; /* FIXME : sys_time should provide it */ _10Hz++; if (_10Hz >= 6) _10Hz = 0; #ifdef RADIO_CONTROL radio_control_periodic_task(); if (fbw_mode == FBW_MODE_MANUAL && radio_control.status == RC_REALLY_LOST) { fbw_mode = FBW_MODE_AUTO; } #endif #ifdef INTER_MCU inter_mcu_periodic_task(); if (fbw_mode == FBW_MODE_AUTO && !ap_ok) { set_failsafe_mode(); } #endif #ifdef DOWNLINK fbw_downlink_periodic_task(); #endif if (!_10Hz) { electrical_periodic(); } }
/************* PERIODIC ******************************************************/ void periodic_task_fbw( void ) { static uint8_t _10Hz; /* FIXME : sys_time should provide it */ _10Hz++; if (_10Hz >= 6) _10Hz = 0; #ifdef RADIO_CONTROL radio_control_periodic_task(); if (radio_control.status == RC_REALLY_LOST) { fbw_mode = fbw_rc_really_lost_mode; // pprz_mode= PPRZ_MODE_HOME; } if (fbw_mode == FBW_MODE_FAILSAFE) set_failsafe_mode(); if (fbw_mode == FBW_MODE_MANUAL && radio_control.status == RC_REALLY_LOST) { fbw_mode = FBW_MODE_AUTO; } #endif /*if (radio_control.status == RC_REALLY_LOST) { fbw_mode = FBW_MODE_FAILSAFE; set_failsafe_mode(); }*/ if (radio_control.status==RC_OK) { if (pprz_mode == PPRZ_MODE_MANUAL) { fbw_mode = FBW_MODE_MANUAL; } else { if ((pprz_mode == PPRZ_MODE_AUTO1) || (pprz_mode == PPRZ_MODE_AUTO2)) fbw_mode = FBW_MODE_AUTO; } } #ifdef INTER_MCU inter_mcu_periodic_task(); if (fbw_mode == FBW_MODE_AUTO && !ap_ok) set_failsafe_mode(); #endif #ifdef DOWNLINK fbw_downlink_periodic_task(); #endif if (!_10Hz) { electrical_periodic(); } #ifdef ACTUATORS #ifdef USE_RC_GYRO if ((fbw_mode == FBW_MODE_MANUAL) || (fbw_mode==FBW_MODE_AUTO)) { rc_gyro_apply_damping(commands); SetActuatorsFromCommands(rc_gyro_damped_commands) }
/** * Handles inter_mcu periodic checks */ void inter_mcu_periodic_handle(void) { inter_mcu_periodic_task(); if (fbw_mode == FBW_MODE_AUTO && !ap_ok) { set_failsafe_mode(); } #if defined MCU_UART_LINK || defined MCU_CAN_LINK inter_mcu_fill_fbw_state(); link_mcu_periodic_task(); #endif /* defined MCU_UART_LINK || defined MCU_CAN_LINK */ }
/************* PERIODIC ******************************************************/ void periodic_task_fbw(void) { #ifdef FBW_DATALINK fbw_datalink_periodic(); #endif #ifdef RADIO_CONTROL radio_control_periodic_task(); if (fbw_mode == FBW_MODE_MANUAL && radio_control.status == RC_REALLY_LOST) { #if OUTBACK_CHALLENGE_DANGEROUS_RULE_RC_LOST_NO_AP #warning WARNING DANGER: OUTBACK_CHALLENGE RULE RC_LOST_NO_AP defined. If you loose RC you will NOT go to automatically go to AUTO2 Anymore!! set_failsafe_mode(); #if OUTBACK_CHALLENGE_DANGEROUS_RULE_RC_LOST_NO_AP_IRREVERSIBLE #warning WARNING DANGER: OUTBACK_CHALLENGE_DANGEROUS_RULE_RC_LOST_NO_AP_IRREVERSIBLE defined. If you ever temporarly lost RC while in manual, you will failsafe forever even if RC is restored commands[COMMAND_FORCECRASH] = 9600; #endif #else fbw_mode = FBW_MODE_AUTO; #endif } #endif #ifdef INTER_MCU inter_mcu_periodic_task(); if (fbw_mode == FBW_MODE_AUTO && !ap_ok) { set_failsafe_mode(); } #endif #ifdef MCU_UART_LINK inter_mcu_fill_fbw_state(); link_mcu_periodic_task(); #endif #ifdef MCU_CAN_LINK inter_mcu_fill_fbw_state(); link_mcu_periodic_task(); #endif #if PERIODIC_TELEMETRY periodic_telemetry_send_Fbw(&(DefaultChannel).trans_tx, &(DefaultDevice).device); #endif }
/************* PERIODIC ******************************************************/ void periodic_task_fbw( void ) { static uint8_t _10Hz; /* FIXME : sys_time should provide it */ _10Hz++; if (_10Hz >= 6) _10Hz = 0; #ifdef RADIO_CONTROL radio_control_periodic_task(); if (fbw_mode == FBW_MODE_MANUAL && rc_status == RC_REALLY_LOST) { fbw_mode = FBW_MODE_AUTO; } #endif #ifdef INTER_MCU inter_mcu_periodic_task(); if (fbw_mode == FBW_MODE_AUTO && !ap_ok) set_failsafe_mode(); #endif #ifdef DOWNLINK fbw_downlink_periodic_task(); #endif #ifdef ADC if (!_10Hz) fbw_vsupply_decivolt = VoltageOfAdc((10*(vsupply_adc_buf.sum/vsupply_adc_buf.av_nb_sample))); #endif #ifdef ACTUATORS #ifdef CTL_GRZ if (rc_status == RC_REALLY_LOST) { set_failsafe_mode(); } else { ctl_grz_rate_run(); } #endif /* CTL_GRZ */ SetActuatorsFromCommands(commands); #endif }
/************* PERIODIC ******************************************************/ void periodic_task_fbw( void ) { #ifdef RADIO_CONTROL radio_control_periodic_task(); if (fbw_mode == FBW_MODE_MANUAL && radio_control.status == RC_REALLY_LOST) { fbw_mode = FBW_MODE_AUTO; } #endif #ifdef INTER_MCU inter_mcu_periodic_task(); if (fbw_mode == FBW_MODE_AUTO && !ap_ok) { set_failsafe_mode(); } #endif #ifdef DOWNLINK fbw_downlink_periodic_task(); #endif }