diff --git a/src/AutoPilotPlugins/APM/APMSensorsComponent.qml b/src/AutoPilotPlugins/APM/APMSensorsComponent.qml index fd0a6ac1b1c29570109ef64eec22c5733e6b35e3..ffe8c926c8bc6fe9dfcab1de2382cf5375808912 100644 --- a/src/AutoPilotPlugins/APM/APMSensorsComponent.qml +++ b/src/AutoPilotPlugins/APM/APMSensorsComponent.qml @@ -169,7 +169,7 @@ SetupPage { anchors.left: parent.left anchors.right: parent.right spacing: Math.round(ScreenTools.defaultFontPixelHeight / 2) - visible: sensorParams.rgCompassAvailable[index] + visible: sensorParams.rgCompassAvailable[index] && sensorParams.rgCompassUseFact[index].value property real greenMaxThreshold: 8 * (sensorParams.rgCompassExternal[index] ? 1 : 2) property real yellowMaxThreshold: 15 * (sensorParams.rgCompassExternal[index] ? 1 : 2) diff --git a/src/AutoPilotPlugins/APM/APMSensorsComponentController.cc b/src/AutoPilotPlugins/APM/APMSensorsComponentController.cc index adcc5d0c1b37a2921e4ddb6ae0bdfc8c49d8a00a..3ae7d7d87e4ec4ebdf044e80418fe1249a3902e3 100644 --- a/src/AutoPilotPlugins/APM/APMSensorsComponentController.cc +++ b/src/AutoPilotPlugins/APM/APMSensorsComponentController.cc @@ -226,7 +226,8 @@ void APMSensorsComponentController::_mavCommandResult(int vehicleId, int compone _startLogCalibration(); uint8_t compassBits = 0; - if (getParameterFact(FactSystem::defaultComponentId, "COMPASS_DEV_ID")->rawValue().toInt() > 0) { + if (getParameterFact(FactSystem::defaultComponentId, "COMPASS_DEV_ID")->rawValue().toInt() > 0 && + getParameterFact(FactSystem::defaultComponentId, QStringLiteral("COMPASS_USE"))->rawValue().toBool()) { compassBits |= 1 << 0; qCDebug(APMSensorsComponentControllerLog) << "Performing onboard compass cal for compass 1"; } else { @@ -234,7 +235,8 @@ void APMSensorsComponentController::_mavCommandResult(int vehicleId, int compone _rgCompassCalSucceeded[0] = true; _rgCompassCalFitness[0] = 0; } - if (getParameterFact(FactSystem::defaultComponentId, "COMPASS_DEV_ID2")->rawValue().toInt() > 0) { + if (getParameterFact(FactSystem::defaultComponentId, "COMPASS_DEV_ID2")->rawValue().toInt() > 0 && + getParameterFact(FactSystem::defaultComponentId, QStringLiteral("COMPASS_USE2"))->rawValue().toBool()) { compassBits |= 1 << 1; qCDebug(APMSensorsComponentControllerLog) << "Performing onboard compass cal for compass 2"; } else { @@ -242,7 +244,8 @@ void APMSensorsComponentController::_mavCommandResult(int vehicleId, int compone _rgCompassCalSucceeded[1] = true; _rgCompassCalFitness[1] = 0; } - if (getParameterFact(FactSystem::defaultComponentId, "COMPASS_DEV_ID3")->rawValue().toInt() > 0) { + if (getParameterFact(FactSystem::defaultComponentId, "COMPASS_DEV_ID3")->rawValue().toInt() > 0 && + getParameterFact(FactSystem::defaultComponentId, QStringLiteral("COMPASS_USE3"))->rawValue().toBool()) { compassBits |= 1 << 2; qCDebug(APMSensorsComponentControllerLog) << "Performing onboard compass cal for compass 3"; } else {