From c7e8a48a554b51812d7f2d3e6f3f6cba66def699 Mon Sep 17 00:00:00 2001 From: squilter Date: Mon, 11 Jan 2016 10:29:03 -0500 Subject: [PATCH] Plane: deploy parachute as fs action --- ArduPlane/Parameters.cpp | 4 ++-- ArduPlane/events.cpp | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/ArduPlane/Parameters.cpp b/ArduPlane/Parameters.cpp index 266f4205e3..57b1c4ab55 100644 --- a/ArduPlane/Parameters.cpp +++ b/ArduPlane/Parameters.cpp @@ -558,8 +558,8 @@ const AP_Param::Info Plane::var_info[] = { // @Param: FS_LONG_ACTN // @DisplayName: Long failsafe action - // @Description: The action to take on a long (FS_LONG_TIMEOUT seconds) failsafe event. If the aircraft was in a stabilization or manual mode when failsafe started and a long failsafe occurs then it will change to RTL mode if FS_LONG_ACTN is 0 or 1, and will change to FBWA if FS_LONG_ACTN is set to 2. If the aircraft was in an auto mode (such as AUTO or GUIDED) when the failsafe started then it will continue in the auto mode if FS_LONG_ACTN is set to 0, will change to RTL mode if FS_LONG_ACTN is set to 1 and will change to FBWA mode if FS_LONG_ACTN is set to 2. - // @Values: 0:Continue,1:ReturnToLaunch,2:Glide + // @Description: The action to take on a long (FS_LONG_TIMEOUT seconds) failsafe event. If the aircraft was in a stabilization or manual mode when failsafe started and a long failsafe occurs then it will change to RTL mode if FS_LONG_ACTN is 0 or 1, and will change to FBWA if FS_LONG_ACTN is set to 2. If the aircraft was in an auto mode (such as AUTO or GUIDED) when the failsafe started then it will continue in the auto mode if FS_LONG_ACTN is set to 0, will change to RTL mode if FS_LONG_ACTN is set to 1 and will change to FBWA mode if FS_LONG_ACTN is set to 2. If FS_LONG_ACTION is set to 3, the parachute will be deployed (make sure the chute is configured and enabled). + // @Values: 0:Continue,1:ReturnToLaunch,2:Glide,3:Deploy Parachute // @User: Standard GSCALAR(long_fs_action, "FS_LONG_ACTN", LONG_FAILSAFE_ACTION), diff --git a/ArduPlane/events.cpp b/ArduPlane/events.cpp index 70873627fd..59031d1658 100644 --- a/ArduPlane/events.cpp +++ b/ArduPlane/events.cpp @@ -75,7 +75,12 @@ void Plane::failsafe_long_on_event(enum failsafe_state fstype) case CRUISE: case TRAINING: case CIRCLE: - if(g.long_fs_action == 2) { + if(g.long_fs_action == 3) { +#if PARACHUTE == ENABLED + parachute_release(); + disarm_motors(); +#endif + } else if (g.long_fs_action == 2) { set_mode(FLY_BY_WIRE_A); } else { set_mode(RTL); @@ -90,7 +95,12 @@ void Plane::failsafe_long_on_event(enum failsafe_state fstype) case AUTO: case GUIDED: case LOITER: - if(g.long_fs_action == 2) { + if(g.long_fs_action == 3) { +#if PARACHUTE == ENABLED + parachute_release(); + disarm_motors(); +#endif + } else if (g.long_fs_action == 2) { set_mode(FLY_BY_WIRE_A); } else if (g.long_fs_action == 1) { set_mode(RTL);