Copter: aux switches for relays 2,3 and 4

This commit is contained in:
Gavin Mogensen 2016-01-05 12:54:05 +10:00 committed by Randy Mackay
parent e216f814c5
commit 3918987507
2 changed files with 17 additions and 3 deletions

View File

@ -65,7 +65,10 @@ enum aux_sw_func {
AUXSW_LOST_COPTER_SOUND = 30, // Play lost copter sound AUXSW_LOST_COPTER_SOUND = 30, // Play lost copter sound
AUXSW_MOTOR_ESTOP = 31, // Emergency Stop Switch AUXSW_MOTOR_ESTOP = 31, // Emergency Stop Switch
AUXSW_MOTOR_INTERLOCK = 32, // Motor On/Off switch AUXSW_MOTOR_INTERLOCK = 32, // Motor On/Off switch
AUXSW_BRAKE = 33 // Brake flight mode AUXSW_BRAKE = 33, // Brake flight mode
AUXSW_RELAY2 = 34, // Relay2 pin on/off (in Mission planner set CH8_OPT = 34)
AUXSW_RELAY3 = 35, // Relay3 pin on/off (in Mission planner set CH9_OPT = 35)
AUXSW_RELAY4 = 36 // Relay4 pin on/off (in Mission planner set CH10_OPT = 36)
}; };
// Frame types // Frame types

View File

@ -235,7 +235,6 @@ void Copter::init_aux_switch_function(int8_t ch_option, uint8_t ch_flag)
case AUXSW_MISSION_RESET: case AUXSW_MISSION_RESET:
case AUXSW_ATTCON_FEEDFWD: case AUXSW_ATTCON_FEEDFWD:
case AUXSW_ATTCON_ACCEL_LIM: case AUXSW_ATTCON_ACCEL_LIM:
case AUXSW_RELAY:
case AUXSW_LANDING_GEAR: case AUXSW_LANDING_GEAR:
case AUXSW_MOTOR_ESTOP: case AUXSW_MOTOR_ESTOP:
case AUXSW_MOTOR_INTERLOCK: case AUXSW_MOTOR_INTERLOCK:
@ -521,7 +520,19 @@ void Copter::do_aux_switch_function(int8_t ch_function, uint8_t ch_flag)
ServoRelayEvents.do_set_relay(0, ch_flag == AUX_SWITCH_HIGH); ServoRelayEvents.do_set_relay(0, ch_flag == AUX_SWITCH_HIGH);
break; break;
case AUXSW_LANDING_GEAR: case AUXSW_RELAY2:
ServoRelayEvents.do_set_relay(1, ch_flag == AUX_SWITCH_HIGH);
break;
case AUXSW_RELAY3:
ServoRelayEvents.do_set_relay(2, ch_flag == AUX_SWITCH_HIGH);
break;
case AUXSW_RELAY4:
ServoRelayEvents.do_set_relay(3, ch_flag == AUX_SWITCH_HIGH);
break;
case AUXSW_LANDING_GEAR:
switch (ch_flag) { switch (ch_flag) {
case AUX_SWITCH_LOW: case AUX_SWITCH_LOW:
landinggear.set_cmd_mode(LandingGear_Deploy); landinggear.set_cmd_mode(LandingGear_Deploy);