From 8aa3ec9c68103112647b64ee5f8fb64207597e3c Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Tue, 7 Dec 2021 11:36:45 -0800 Subject: [PATCH] Hack to set vehicle type when FRAME_CLASS is not set. --- src/AutoPilotPlugins/APM/APMAirframeComponent.qml | 2 +- src/Vehicle/MultiVehicleManager.cc | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/AutoPilotPlugins/APM/APMAirframeComponent.qml b/src/AutoPilotPlugins/APM/APMAirframeComponent.qml index a11e838..a9f9b42 100644 --- a/src/AutoPilotPlugins/APM/APMAirframeComponent.qml +++ b/src/AutoPilotPlugins/APM/APMAirframeComponent.qml @@ -72,7 +72,7 @@ SetupPage { qsTr("Currently set to frame class '%1'").arg(_frameClass.enumStringValue) + (_frameTypeAvailable ? qsTr(" and frame type '%2'").arg(_frameType.enumStringValue) : "") + qsTr(".", "period for end of sentence")) + - qsTr(" To change this configuration, select the desired frame class below.") + qsTr(" To change this configuration, select the desired frame class below and then reboot the vehicle.") font.family: ScreenTools.demiboldFontFamily wrapMode: Text.WordWrap } diff --git a/src/Vehicle/MultiVehicleManager.cc b/src/Vehicle/MultiVehicleManager.cc index c02b708..1334d11 100644 --- a/src/Vehicle/MultiVehicleManager.cc +++ b/src/Vehicle/MultiVehicleManager.cc @@ -91,6 +91,15 @@ void MultiVehicleManager::_vehicleHeartbeatInfo(LinkInterface* link, int vehicle } } +#if !defined(NO_ARDUPILOT_DIALECT) + // When you flash a new ArduCopter it does not set a FRAME_CLASS for some reason. This is the only ArduPilot variant which + // works this way. Because of this the vehicle type is not known at first connection. In order to make QGC work reasonably + // we assume ArduCopter for this case. + if (vehicleType == 0 && vehicleFirmwareType == MAV_AUTOPILOT_ARDUPILOTMEGA) { + vehicleType = MAV_TYPE_QUADROTOR; + } +#endif + if (_vehicles.count() > 0 && !qgcApp()->toolbox()->corePlugin()->options()->multiVehicleEnabled()) { return; }