diff --git a/src/FirmwarePlugin/APM/APMFirmwarePlugin.cc b/src/FirmwarePlugin/APM/APMFirmwarePlugin.cc index 94c0545cffedddf3b72a09de737b77f2b304806f..3cf164b010c35fa78c377f826e16b3e99929f929 100644 --- a/src/FirmwarePlugin/APM/APMFirmwarePlugin.cc +++ b/src/FirmwarePlugin/APM/APMFirmwarePlugin.cc @@ -17,6 +17,8 @@ #include "MissionManager.h" #include "ParameterManager.h" #include "QGCFileDownload.h" +#include "SettingsManager.h" +#include "AppSettings.h" #include @@ -641,8 +643,10 @@ void APMFirmwarePlugin::initializeVehicle(Vehicle* vehicle) break; } } else { - // Streams are not started automatically on APM stack - initializeStreamRates(vehicle); + if (qgcApp()->toolbox()->settingsManager()->appSettings()->apmStartMavlinkStreams()->rawValue().toBool()) { + // Streams are not started automatically on APM stack (sort of) + initializeStreamRates(vehicle); + } } } diff --git a/src/Settings/App.SettingsGroup.json b/src/Settings/App.SettingsGroup.json index 7daaa6217f57037dd1a7580f0eca1c0add8f65be..928ca916813562c9230d61cd724948418a88bccf 100644 --- a/src/Settings/App.SettingsGroup.json +++ b/src/Settings/App.SettingsGroup.json @@ -199,5 +199,11 @@ "enumStrings": "Never,Always,When in Follow Me Flight Mode", "enumValues": "0,1,2", "defaultValue": 0 +}, +{ + "name": "apmStartMavlinkStreams", + "shortDescription": "Request start of MAVLink telemetry streams (ArduPilot only)", + "type": "bool", + "defaultValue": true } ] diff --git a/src/Settings/AppSettings.cc b/src/Settings/AppSettings.cc index e4209c16bebf377eccc774246b3fc2f69a2abc69..f8d0057382d79232b6a3712feac9c092f014fd1b 100644 --- a/src/Settings/AppSettings.cc +++ b/src/Settings/AppSettings.cc @@ -84,6 +84,7 @@ DECLARE_SETTINGSFACT(AppSettings, esriToken) DECLARE_SETTINGSFACT(AppSettings, defaultFirmwareType) DECLARE_SETTINGSFACT(AppSettings, gstDebugLevel) DECLARE_SETTINGSFACT(AppSettings, followTarget) +DECLARE_SETTINGSFACT(AppSettings, apmStartMavlinkStreams) DECLARE_SETTINGSFACT_NO_FUNC(AppSettings, indoorPalette) { diff --git a/src/Settings/AppSettings.h b/src/Settings/AppSettings.h index 584ce819dcc77a25e49681cd673f7787bd64cbee..46e9a61e3bac4281c411240e7a3edb3c27ee63ae 100644 --- a/src/Settings/AppSettings.h +++ b/src/Settings/AppSettings.h @@ -44,6 +44,9 @@ public: DEFINE_SETTINGFACT(gstDebugLevel) DEFINE_SETTINGFACT(followTarget) + // Although this is a global setting it only affects ArduPilot vehicle since PX4 automatically starts the stream from the vehicle side + DEFINE_SETTINGFACT(apmStartMavlinkStreams) + Q_PROPERTY(QString missionSavePath READ missionSavePath NOTIFY savePathsChanged) Q_PROPERTY(QString parameterSavePath READ parameterSavePath NOTIFY savePathsChanged) Q_PROPERTY(QString telemetrySavePath READ telemetrySavePath NOTIFY savePathsChanged) diff --git a/src/ui/preferences/MavlinkSettings.qml b/src/ui/preferences/MavlinkSettings.qml index 5e33a084943e6bedaf394ec3c62c304962610797..ac4a8d468468a221804ed14ae4886379f66e1e76 100644 --- a/src/ui/preferences/MavlinkSettings.qml +++ b/src/ui/preferences/MavlinkSettings.qml @@ -15,6 +15,7 @@ import QtQuick.Dialogs 1.2 import QGroundControl 1.0 import QGroundControl.FactSystem 1.0 +import QGroundControl.FactControls 1.0 import QGroundControl.Controls 1.0 import QGroundControl.ScreenTools 1.0 import QGroundControl.MultiVehicleManager 1.0 @@ -132,8 +133,7 @@ Rectangle { } } } - //----------------------------------------------------------------- - //-- Mavlink Heartbeats + QGCCheckBox { text: qsTr("Emit heartbeat") checked: QGroundControl.multiVehicleManager.gcsHeartBeatEnabled @@ -141,8 +141,12 @@ Rectangle { QGroundControl.multiVehicleManager.gcsHeartBeatEnabled = checked } } - //----------------------------------------------------------------- - //-- Mavlink Version Check + + FactCheckBox { + text: fact.shortDescription + fact: QGroundControl.settingsManager.appSettings.apmStartMavlinkStreams + } + QGCCheckBox { text: qsTr("Only accept MAVs with same protocol version") checked: QGroundControl.isVersionCheckEnabled