From dc0941ac09cdc14fbeed001923f6d7deea3c6c8e Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Sun, 22 Sep 2024 13:46:09 +1000 Subject: [PATCH] ArduPlane: correct initialisation of PrecLand buffers this value determines the size of buffers allocated. Too high and you waste RAM. Too low and you probably won't store data correctly. --- ArduPlane/system.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ArduPlane/system.cpp b/ArduPlane/system.cpp index a38e00b9a2..a71e5790c1 100644 --- a/ArduPlane/system.cpp +++ b/ArduPlane/system.cpp @@ -162,7 +162,9 @@ void Plane::init_ardupilot() #endif #if AC_PRECLAND_ENABLED - g2.precland.init(scheduler.get_loop_rate_hz()); + // scheduler table specifies 400Hz, but we can call it no faster + // than the scheduler loop rate: + g2.precland.init(MIN(400, scheduler.get_loop_rate_hz())); #endif #if AP_ICENGINE_ENABLED