From 44360a769d10e09dafe47eb160d40b72f9a26294 Mon Sep 17 00:00:00 2001 From: Tatsuya Yamaguchi Date: Tue, 13 Nov 2018 16:32:38 +0900 Subject: [PATCH] Rover: fix to use defined value of failsafe action --- APMrover2/Parameters.cpp | 2 +- APMrover2/failsafe.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/APMrover2/Parameters.cpp b/APMrover2/Parameters.cpp index 0bef8fd54d..ccd879dcd8 100644 --- a/APMrover2/Parameters.cpp +++ b/APMrover2/Parameters.cpp @@ -130,7 +130,7 @@ const AP_Param::Info Rover::var_info[] = { // @Description: What to do on a failsafe event // @Values: 0:Nothing,1:RTL,2:Hold,3:SmartRTL or RTL,4:SmartRTL or Hold // @User: Standard - GSCALAR(fs_action, "FS_ACTION", 2), + GSCALAR(fs_action, "FS_ACTION", Failsafe_Action_Hold), // @Param: FS_TIMEOUT // @DisplayName: Failsafe timeout diff --git a/APMrover2/failsafe.cpp b/APMrover2/failsafe.cpp index 2f8a36d11b..76d12ee271 100644 --- a/APMrover2/failsafe.cpp +++ b/APMrover2/failsafe.cpp @@ -74,24 +74,24 @@ void Rover::failsafe_trigger(uint8_t failsafe_type, bool on) RC_Channels::clear_overrides(); switch (g.fs_action) { - case 0: + case Failsafe_Action_None: break; - case 1: + case Failsafe_Action_RTL: if (!set_mode(mode_rtl, MODE_REASON_FAILSAFE)) { set_mode(mode_hold, MODE_REASON_FAILSAFE); } break; - case 2: + case Failsafe_Action_Hold: set_mode(mode_hold, MODE_REASON_FAILSAFE); break; - case 3: + case Failsafe_Action_SmartRTL: if (!set_mode(mode_smartrtl, MODE_REASON_FAILSAFE)) { if (!set_mode(mode_rtl, MODE_REASON_FAILSAFE)) { set_mode(mode_hold, MODE_REASON_FAILSAFE); } } break; - case 4: + case Failsafe_Action_SmartRTL_Hold: if (!set_mode(mode_smartrtl, MODE_REASON_FAILSAFE)) { set_mode(mode_hold, MODE_REASON_FAILSAFE); }