From 51dffffd80d68b1dbdd7e928d0dc831356d18af0 Mon Sep 17 00:00:00 2001 From: Matt Lawrence Date: Sat, 5 Jan 2019 10:33:32 -0500 Subject: [PATCH] Artoo: Short holding home button triggers Smart RTL --- artoo/src/flightmanager.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/artoo/src/flightmanager.cpp b/artoo/src/flightmanager.cpp index 88a7f27..f947dc7 100644 --- a/artoo/src/flightmanager.cpp +++ b/artoo/src/flightmanager.cpp @@ -255,13 +255,6 @@ void FlightManager::onRtlButtonEvt(Button *b, Button::Event evt) if (evt == Button::ClickRelease) { if (inFlight()) { - // request RTL whether we think vehicle has GPS or not. - // if our sense of vehicle GPS state is stale, we still - // want to trigger an RTL if at all possible. - // - // if we have confidence that our copy of vehicle state is current, - // we could trigger Event::RTLWithoutGPS to inform user - // RTL without GPS is not possible. requestFlightModeChange(RTL); if (!telemetryVals.hasGpsFix()) { @@ -270,6 +263,16 @@ void FlightManager::onRtlButtonEvt(Button *b, Button::Event evt) Haptic::startPattern(Haptic::SingleMedium); } + } else if (evt == Button::HoldRelease) { + if (inFlight()) { + requestFlightModeChange(SMART_RTL); + + if (!telemetryVals.hasGpsFix()) { + Ui::instance.pendEvent(Event::RTLWithoutGPS); + } + + Haptic::startPattern(Haptic::SingleShort); + } } }