Esempio n. 1
0
/*
  run configured output mixer. This takes calculated servo_out values
  for each channel and calculates PWM values, then pushes them to
  hal.rcout
 */
void Plane::servos_output(void)
{
    SRV_Channels::cork();

    // support twin-engine aircraft
    servos_twin_engine_mix();

    // cope with tailsitters
    quadplane.tailsitter_output();
    
    // the mixers need pwm to be calculated now
    SRV_Channels::calc_pwm();
    
    // run vtail and elevon mixers
    servo_output_mixers();

    // support MANUAL_RCMASK
    if (g2.manual_rc_mask.get() != 0 && control_mode == MANUAL) {
        SRV_Channels::copy_radio_in_out_mask(uint16_t(g2.manual_rc_mask.get()));
    }
    
    SRV_Channels::calc_pwm();

    SRV_Channels::output_ch_all();
    
    SRV_Channels::push();

    if (g2.servo_channels.auto_trim_enabled()) {
        servos_auto_trim();
    }
}
Esempio n. 2
0
/*
  run configured output mixer. This takes calculated servo_out values
  for each channel and calculates PWM values, then pushes them to
  hal.rcout
 */
void Plane::servos_output(void)
{
    hal.rcout->cork();

    // to enable the throttle slew rate to work we need to remember
    // and restore the throttle radio_out
    uint16_t thr_radio_out_saved = channel_throttle->get_radio_out();
    
    // remap servo output to SERVO* ranges if enabled
    g2.servo_channels.remap_servo_output();

    // run vtail and elevon mixers
    servo_output_mixers();

    channel_roll->output();
    channel_pitch->output();
    channel_throttle->output();
    channel_rudder->output();

    if (!afs.should_crash_vehicle()) {
        RC_Channel_aux::output_ch_all();
    }
    
    hal.rcout->push();

    // restore throttle radio out
    channel_throttle->set_radio_out(thr_radio_out_saved);
    
    if (g2.servo_channels.auto_trim_enabled()) {
        servos_auto_trim();
    }
}