diff --git a/src/lib/events/enums.json b/src/lib/events/enums.json index 717fd0bf7c..75af36a1d1 100644 --- a/src/lib/events/enums.json +++ b/src/lib/events/enums.json @@ -421,18 +421,22 @@ "description": "RTL" }, "7": { + "name": "dead_reckon_rtl", + "description": "Dead Reckoning RTL" + }, + "8": { "name": "land", "description": "Land" }, - "8": { + "9": { "name": "descend", "description": "Descend" }, - "9": { + "10": { "name": "disarm", "description": "disarm" }, - "10": { + "11": { "name": "terminate", "description": "terminate" } diff --git a/src/modules/commander/failsafe/framework.cpp b/src/modules/commander/failsafe/framework.cpp index 0632c0681e..8397a8643f 100644 --- a/src/modules/commander/failsafe/framework.cpp +++ b/src/modules/commander/failsafe/framework.cpp @@ -571,6 +571,15 @@ void FailsafeBase::getSelectedAction(const State &state, const failsafe_flags_s returned_state.cause = Cause::Generic; + // fallthrough + case Action::DeadReckonRTL: + if (modeCanRun(status_flags, vehicle_status_s::NAVIGATION_STATE_AUTO_RTL_DR)) { + selected_action = Action::DeadReckonRTL; + break; + } + + returned_state.cause = Cause::Generic; + // fallthrough case Action::Land: if (modeCanRun(status_flags, vehicle_status_s::NAVIGATION_STATE_AUTO_LAND)) { @@ -671,6 +680,8 @@ uint8_t FailsafeBase::modeFromAction(const Action &action, uint8_t user_intended case Action::RTL: return vehicle_status_s::NAVIGATION_STATE_AUTO_RTL; + case Action::DeadReckonRTL: return vehicle_status_s::NAVIGATION_STATE_AUTO_RTL_DR; + case Action::Land: return vehicle_status_s::NAVIGATION_STATE_AUTO_LAND; case Action::Descend: return vehicle_status_s::NAVIGATION_STATE_DESCEND; diff --git a/src/modules/commander/failsafe/framework.h b/src/modules/commander/failsafe/framework.h index a0ff26601b..6ad1f45b76 100644 --- a/src/modules/commander/failsafe/framework.h +++ b/src/modules/commander/failsafe/framework.h @@ -61,6 +61,7 @@ public: Hold, RTL, + DeadReckonRTL, Land, Descend, Disarm, @@ -105,6 +106,8 @@ public: case Action::RTL: return "RTL"; + case Action::DeadReckonRTL: return "Dead Reckoning RTL"; + case Action::Land: return "Land"; case Action::Descend: return "Descend";