From 1a1edf92b71a474c1bf1a081a7e8ae15c7724f5c Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Tue, 8 Oct 2024 20:39:22 +1100 Subject: [PATCH] Plane: evaluate assistance requirements on mode change this avoid the AHRS being told we are flying forward - because we are no longer in a VTOL mode - and instantly being told we are not flying forward - because we are providing assistance --- ArduPlane/mode.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ArduPlane/mode.cpp b/ArduPlane/mode.cpp index ade2abb2a3..d9fec93dff 100644 --- a/ArduPlane/mode.cpp +++ b/ArduPlane/mode.cpp @@ -140,6 +140,14 @@ bool Mode::enter() // Make sure the flight stage is correct for the new mode plane.update_flight_stage(); + +#if HAL_QUADPLANE_ENABLED + if (quadplane.enabled()) { + float aspeed; + bool have_airspeed = quadplane.ahrs.airspeed_estimate(aspeed); + quadplane.assisted_flight = quadplane.assist.should_assist(aspeed, have_airspeed); + } +#endif } return enter_result;