From 6ba87dfe9a07d9c1767bc4c1ed5e06fb4e59bde8 Mon Sep 17 00:00:00 2001 From: Iampete1 Date: Tue, 2 Nov 2021 20:20:55 +0000 Subject: [PATCH] AP_Compass: add param conversion --- libraries/AP_Compass/AP_Compass.cpp | 43 +++++++++++++++++++++++++++++ libraries/AP_Compass/AP_Compass.h | 3 ++ 2 files changed, 46 insertions(+) diff --git a/libraries/AP_Compass/AP_Compass.cpp b/libraries/AP_Compass/AP_Compass.cpp index 5f18df1fbf..c8b32d2a3a 100644 --- a/libraries/AP_Compass/AP_Compass.cpp +++ b/libraries/AP_Compass/AP_Compass.cpp @@ -379,6 +379,8 @@ void Compass::init() } #endif // COMPASS_MAX_INSTANCES + convert_per_instance(); + // cache expected dev ids for use during runtime detection for (StateIndex i(0); isnprintf(param_name, sizeof(param_name), "COMPASS%i_%s", i+1, elem.name); + AP_Param::convert_old_parameter(&info, 1.0f, 0); + } + } +} + #if COMPASS_MAX_INSTANCES > 1 || COMPASS_MAX_UNREG_DEV // Update Priority List for Mags, by default, we just // load them as they come up the first time diff --git a/libraries/AP_Compass/AP_Compass.h b/libraries/AP_Compass/AP_Compass.h index 651a523241..351b5bce93 100644 --- a/libraries/AP_Compass/AP_Compass.h +++ b/libraries/AP_Compass/AP_Compass.h @@ -598,6 +598,9 @@ private: bool init_done; uint8_t _first_usable; // first compass usable based on COMPASSx_USE param + + // convet params to per instance param table + void convert_per_instance(); }; namespace AP {