From f36f38794853f62457aae872ec30a4135904a0d2 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Tue, 15 Nov 2022 16:37:36 +1100 Subject: [PATCH] AP_NavEKF2: make rngBcnDataToFuse const false if beacon not compiled in --- libraries/AP_NavEKF2/AP_NavEKF2_core.cpp | 2 ++ libraries/AP_NavEKF2/AP_NavEKF2_core.h | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/libraries/AP_NavEKF2/AP_NavEKF2_core.cpp b/libraries/AP_NavEKF2/AP_NavEKF2_core.cpp index a9c8b7d83f..abc916f333 100644 --- a/libraries/AP_NavEKF2/AP_NavEKF2_core.cpp +++ b/libraries/AP_NavEKF2/AP_NavEKF2_core.cpp @@ -263,7 +263,9 @@ void NavEKF2_core::InitialiseVariables() varInnovRngBcn = 0.0f; innovRngBcn = 0.0f; memset(&lastTimeRngBcn_ms, 0, sizeof(lastTimeRngBcn_ms)); +#if AP_BEACON_ENABLED rngBcnDataToFuse = false; +#endif beaconVehiclePosNED.zero(); beaconVehiclePosErr = 1.0f; rngBcnLast3DmeasTime_ms = 0; diff --git a/libraries/AP_NavEKF2/AP_NavEKF2_core.h b/libraries/AP_NavEKF2/AP_NavEKF2_core.h index 1a2dc6e840..e25bad340a 100644 --- a/libraries/AP_NavEKF2/AP_NavEKF2_core.h +++ b/libraries/AP_NavEKF2/AP_NavEKF2_core.h @@ -1019,7 +1019,11 @@ private: ftype varInnovRngBcn; // range beacon observation innovation variance (m^2) ftype innovRngBcn; // range beacon observation innovation (m) uint32_t lastTimeRngBcn_ms[10]; // last time we received a range beacon measurement (msec) +#if AP_BEACON_ENABLED bool rngBcnDataToFuse; // true when there is new range beacon data to fuse +#else + const bool rngBcnDataToFuse = false; // true when there is new range beacon data to fuse +#endif Vector3F beaconVehiclePosNED; // NED position estimate from the beacon system (NED) ftype beaconVehiclePosErr; // estimated position error from the beacon system (m) uint32_t rngBcnLast3DmeasTime_ms; // last time the beacon system returned a 3D fix (msec)