AP_Compass: remove primary compass parameter conversion

Converted the old COMPASS_PRIMARY into the device-id priority list.
Added Feb-2020 and present in the 4.3.0 release, so anybody running
4.3.0 or later has already had it applied.

Note that the conversion sat inside Compass::init(), below its

    if (!_enabled) {
        return;
    }

early return, so "present in the release" is not quite the same as "has
run".  A user who has had COMPASS_ENABLE=0 for every release from 4.3
onwards never reached the conversion, and if they enable the compass
after moving to 4.8 their old COMPASS_PRIMARY selection is not honoured.
That is judged too unlikely - and the parameter too old - to keep the
conversion for.
This commit is contained in:
Peter Barker
2026-09-01 20:49:36 +10:00
committed by Peter Barker
parent da9ecf550a
commit bc914006bf
-18
View File
@@ -719,24 +719,6 @@ void Compass::init()
}
#if COMPASS_MAX_INSTANCES > 1
// PARAMETER_CONVERSION - Added: Feb-2020 for ArduPilot-4.0
// Look if there was a primary compass setup in previous version
// if so and the primary compass is not set in current setup
// make the devid as primary.
if (_priority_did_stored_list[Priority(0)] == 0) {
uint16_t k_param_compass;
if (AP_Param::find_top_level_key_by_pointer(this, k_param_compass)) {
const AP_Param::ConversionInfo primary_compass_old_param = {k_param_compass, 12, AP_PARAM_INT8, ""};
AP_Int8 value;
value.set(0);
bool primary_param_exists = AP_Param::find_old_parameter(&primary_compass_old_param, &value);
int8_t oldvalue = value.get();
if ((oldvalue!=0) && (oldvalue<COMPASS_MAX_INSTANCES) && primary_param_exists) {
_priority_did_stored_list[Priority(0)].set_and_save_ifchanged(_state[StateIndex(oldvalue)].dev_id);
}
}
}
// Load priority list from storage, the changes to priority list
// by user only take effect post reboot, after this
if (!suppress_devid_save) {