Copter: ch7/ch8 parachute release

This commit is contained in:
Randy Mackay 2014-04-03 00:20:45 +09:00
parent ac982656fd
commit 340f3a7f9d
2 changed files with 35 additions and 1 deletions

View File

@ -110,6 +110,8 @@ static void init_aux_switches()
case AUX_SWITCH_EPM:
case AUX_SWITCH_SPRAYER:
case AUX_SWITCH_EKF:
case AUX_SWITCH_PARACHUTE_ENABLE:
case AUX_SWITCH_PARACHUTE_3POS: // we trust the vehicle will be disarmed so even if switch is in release position the chute will not release
do_aux_switch_function(g.ch7_option, ap.CH7_flag);
break;
}
@ -124,6 +126,8 @@ static void init_aux_switches()
case AUX_SWITCH_EPM:
case AUX_SWITCH_SPRAYER:
case AUX_SWITCH_EKF:
case AUX_SWITCH_PARACHUTE_ENABLE:
case AUX_SWITCH_PARACHUTE_3POS: // we trust the vehicle will be disarmed so even if switch is in release position the chute will not release
do_aux_switch_function(g.ch8_option, ap.CH8_flag);
break;
}
@ -365,7 +369,34 @@ static void do_aux_switch_function(int8_t ch_function, uint8_t ch_flag)
ahrs.set_ekf_use(ch_flag==AUX_SWITCH_HIGH);
break;
#endif
#if PARACHUTE == ENABLED
case AUX_SWITCH_PARACHUTE_ENABLE:
// Parachute enable/disable
parachute.enabled(ch_flag == AUX_SWITCH_HIGH);
break;
case AUX_SWITCH_PARACHUTE_RELEASE:
if (ch_flag == AUX_SWITCH_HIGH) {
parachute_release();
}
break;
case AUX_SWITCH_PARACHUTE_3POS:
// Parachute disable, enable, release with 3 position switch
switch (ch_flag) {
case AUX_SWITCH_LOW:
parachute.enabled(false);
break;
case AUX_SWITCH_MIDDLE:
parachute.enabled(true);
break;
case AUX_SWITCH_HIGH:
parachute.enabled(true);
parachute_release();
break;
}
#endif
}
}

View File

@ -53,6 +53,9 @@
#define AUX_SWITCH_LAND 18 // change to LAND flight mode
#define AUX_SWITCH_EPM 19 // Operate the EPM cargo gripper low=off, middle=neutral, high=on
#define AUX_SWITCH_EKF 20 // Enable NavEKF
#define AUX_SWITCH_PARACHUTE_ENABLE 21 // Parachute enable/disable
#define AUX_SWITCH_PARACHUTE_RELEASE 22 // Parachute release
#define AUX_SWITCH_PARACHUTE_3POS 23 // Parachute disable, enable, release with 3 position switch
// values used by the ap.ch7_opt and ap.ch8_opt flags
#define AUX_SWITCH_LOW 0 // indicates auxiliar switch is in the low position (pwm <1200)