Exemplo n.º 1
0
/************* 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();
  }

}
Exemplo n.º 2
0
STATIC_INLINE void handle_periodic_tasks(void)
{
  if (sys_time_check_and_ack_timer(main_periodic_tid)) {
    main_periodic();
  }
  if (sys_time_check_and_ack_timer(modules_tid)) {
    modules_periodic_task();
  }
  if (sys_time_check_and_ack_timer(radio_control_tid)) {
    radio_control_periodic_task();
  }
  if (sys_time_check_and_ack_timer(failsafe_tid)) {
    failsafe_check();
  }
  if (sys_time_check_and_ack_timer(electrical_tid)) {
    electrical_periodic();
  }
  if (sys_time_check_and_ack_timer(telemetry_tid)) {
    telemetry_periodic();
  }
#if USE_BARO_BOARD
  if (sys_time_check_and_ack_timer(baro_tid)) {
    baro_periodic();
  }
#endif
}
Exemplo n.º 3
0
STATIC_INLINE void handle_periodic_tasks(void)
{
    if (sys_time_check_and_ack_timer(main_periodic_tid)) {
        main_periodic();
#if PERIODIC_FREQUENCY == MODULES_FREQUENCY
        /* Use the main periodc freq timer for modules if the freqs are the same
         * This is mainly useful for logging each step.
         */
        modules_periodic_task();
#else
    }
    /* separate timer for modules, since it has a different freq than main */
    if (sys_time_check_and_ack_timer(modules_tid)) {
        modules_periodic_task();
#endif
    }
    if (sys_time_check_and_ack_timer(radio_control_tid)) {
        radio_control_periodic_task();
    }
    if (sys_time_check_and_ack_timer(failsafe_tid)) {
        failsafe_check();
    }
    if (sys_time_check_and_ack_timer(electrical_tid)) {
        electrical_periodic();
    }
    if (sys_time_check_and_ack_timer(telemetry_tid)) {
        telemetry_periodic();
    }
#if USE_BARO_BOARD
    if (sys_time_check_and_ack_timer(baro_tid)) {
        baro_periodic();
    }
#endif
}
Exemplo n.º 4
0
void handle_periodic_tasks_fbw(void) {

  if (sys_time_check_and_ack_timer(fbw_periodic_tid))
    periodic_task_fbw();

  if (sys_time_check_and_ack_timer(electrical_tid))
    electrical_periodic();

}
Exemplo n.º 5
0
/************* 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)
  }
Exemplo n.º 6
0
void handle_periodic_tasks_fbw(void) {

  if (sys_time_check_and_ack_timer(fbw_periodic_tid))
    periodic_task_fbw();

#if !(DISABLE_ELECTRICAL)
  if (sys_time_check_and_ack_timer(electrical_tid))
    electrical_periodic();
#endif

}
Exemplo n.º 7
0
value sim_periodic_task(value unit) {
  sensors_task();
  attitude_loop();
  reporting_task();
  modules_periodic_task();
  periodic_task_fbw();
  electrical_periodic();
  event_task_ap();
  event_task_fbw();
  return unit;
}
Exemplo n.º 8
0
STATIC_INLINE void handle_periodic_tasks( void ) {
  if (sys_time_check_and_ack_timer(main_periodic_tid))
    main_periodic();
  if (sys_time_check_and_ack_timer(radio_control_tid))
    radio_control_periodic_task();
  if (sys_time_check_and_ack_timer(failsafe_tid))
    failsafe_check();
  if (sys_time_check_and_ack_timer(electrical_tid))
    electrical_periodic();
  if (sys_time_check_and_ack_timer(baro_tid))
    baro_periodic();
  if (sys_time_check_and_ack_timer(telemetry_tid))
    telemetry_periodic();
}
Exemplo n.º 9
0
value sim_periodic_task(value unit)
{
  sensors_task();
#if USE_GENERATED_AUTOPILOT
  autopilot_periodic();
#else
  attitude_loop();
#endif
  reporting_task();
  modules_periodic_task();
  periodic_task_fbw();
  electrical_periodic();
  event_task_ap();
  event_task_fbw();
  return unit;
}
Exemplo n.º 10
0
STATIC_INLINE void handle_periodic_tasks(void)
{
  if (sys_time_check_and_ack_timer(main_periodic_tid)) {
    main_periodic();
  }
  if (sys_time_check_and_ack_timer(modules_tid)) {
    modules_periodic_task();
  }
  if (sys_time_check_and_ack_timer(radio_control_tid)) {
    radio_control_periodic_task();
  }
  if (sys_time_check_and_ack_timer(electrical_tid)) {
    electrical_periodic();
  }
  if (sys_time_check_and_ack_timer(telemetry_tid)) {
    telemetry_periodic();
  }
}