Artoo: Short holding home button triggers Smart RTL

This commit is contained in:
Matt Lawrence 2019-01-05 10:33:32 -05:00 committed by Matt
parent 8abf555b35
commit 51dffffd80

View File

@ -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);
}
}
}