Copter: check parachute is enabled before manual_release

This commit is contained in:
Randy Mackay 2014-04-07 12:16:57 +09:00
parent 3600bed47a
commit 9bf9e0ede9
1 changed files with 5 additions and 2 deletions

View File

@ -156,8 +156,6 @@ void parachute_check()
// parachute_release - trigger the release of the parachute, disarm the motors and notify the user // parachute_release - trigger the release of the parachute, disarm the motors and notify the user
static void parachute_release() static void parachute_release()
{ {
// To-Do: add warning tone and short delay before triggering release
// send message to gcs and dataflash // send message to gcs and dataflash
gcs_send_text_P(SEVERITY_HIGH,PSTR("Parachute: Released!")); gcs_send_text_P(SEVERITY_HIGH,PSTR("Parachute: Released!"));
Log_Write_Event(DATA_PARACHUTE_RELEASED); Log_Write_Event(DATA_PARACHUTE_RELEASED);
@ -173,6 +171,11 @@ static void parachute_release()
// checks if the vehicle is landed // checks if the vehicle is landed
static void parachute_manual_release() static void parachute_manual_release()
{ {
// exit immediately if parachute is not enabled
if (!parachute.enabled()) {
return;
}
// do not release if we are landed or below the minimum altitude above home // do not release if we are landed or below the minimum altitude above home
if (ap.land_complete || (parachute.alt_min() != 0 && (baro_alt < (uint32_t)parachute.alt_min() * 100))) { if (ap.land_complete || (parachute.alt_min() != 0 && (baro_alt < (uint32_t)parachute.alt_min() * 100))) {
// warn user of reason for failure // warn user of reason for failure