コード例 #1
0
ファイル: RC_Channel.cpp プロジェクト: tatsuy/ardupilot
void RC_Channel::do_aux_function(const aux_func_t ch_option, const aux_switch_pos_t ch_flag)
{
    switch(ch_option) {
    case CAMERA_TRIGGER:
        do_aux_function_camera_trigger(ch_flag);
        break;

    case RELAY:
        do_aux_function_relay(0, ch_flag == HIGH);
        break;
    case RELAY2:
        do_aux_function_relay(1, ch_flag == HIGH);
        break;
    case RELAY3:
        do_aux_function_relay(2, ch_flag == HIGH);
        break;
    case RELAY4:
        do_aux_function_relay(3, ch_flag == HIGH);
        break;

    default:
        gcs().send_text(MAV_SEVERITY_INFO, "Invalid channel option (%u)", ch_option);
        break;
    }
}
コード例 #2
0
ファイル: RC_Channel.cpp プロジェクト: jyl58/ardupilot
void RC_Channel::do_aux_function(const aux_func_t ch_option, const aux_switch_pos_t ch_flag)
{
    switch(ch_option) {
    case CAMERA_TRIGGER:
        do_aux_function_camera_trigger(ch_flag);
        break;

    case GRIPPER:
        do_aux_function_gripper(ch_flag);
        break;

    case RC_OVERRIDE_ENABLE:
        // Allow or disallow RC_Override
        do_aux_function_rc_override_enable(ch_flag);
        break;

    case AVOID_PROXIMITY:
        do_aux_function_avoid_proximity(ch_flag);
        break;

    case RELAY:
        do_aux_function_relay(0, ch_flag == HIGH);
        break;
    case RELAY2:
        do_aux_function_relay(1, ch_flag == HIGH);
        break;
    case RELAY3:
        do_aux_function_relay(2, ch_flag == HIGH);
        break;
    case RELAY4:
        do_aux_function_relay(3, ch_flag == HIGH);
        break;
    case RELAY5:
        do_aux_function_relay(4, ch_flag == HIGH);
        break;
    case RELAY6:
        do_aux_function_relay(5, ch_flag == HIGH);
        break;
    case CLEAR_WP:
        do_aux_function_clear_wp(ch_flag);
        break;

    case SPRAYER:
        do_aux_function_sprayer(ch_flag);
        break;

    case LOST_VEHICLE_SOUND:
        do_aux_function_lost_vehicle_sound(ch_flag);
        break;

    case COMPASS_LEARN:
        if (ch_flag == HIGH) {
            Compass &compass = AP::compass();
            compass.set_learn_type(Compass::LEARN_INFLIGHT, false);
        }
        break;

    case LANDING_GEAR: {
        AP_LandingGear *lg = AP_LandingGear::get_singleton();
        if (lg == nullptr) {
            break;
        }
        switch (ch_flag) {
        case LOW:
            lg->set_position(AP_LandingGear::LandingGear_Deploy);
            break;
        case MIDDLE:
            // nothing
            break;
        case HIGH:
            lg->set_position(AP_LandingGear::LandingGear_Retract);
            break;
        }
        break;
    }

    case GPS_DISABLE:
        AP::gps().force_disable(ch_flag == HIGH);
        break;
        
    default:
        gcs().send_text(MAV_SEVERITY_INFO, "Invalid channel option (%u)", ch_option);
        break;
    }
}