Skip to content

Commit

Permalink
New Telemetry Settings page
Browse files Browse the repository at this point in the history
  • Loading branch information
DonLakeFlyer committed Jan 29, 2024
1 parent 98dd724 commit d4a5f80
Show file tree
Hide file tree
Showing 6 changed files with 232 additions and 31 deletions.
1 change: 1 addition & 0 deletions qgroundcontrol.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@
<file alias="SurveyItemEditor.qml">src/PlanView/SurveyItemEditor.qml</file>
<file alias="SyslinkComponent.qml">src/AutoPilotPlugins/Common/SyslinkComponent.qml</file>
<file alias="TcpSettings.qml">src/ui/preferences/TcpSettings.qml</file>
<file alias="TelemetrySettings.qml">src/ui/preferences/TelemetrySettings.qml</file>
<file alias="test.qml">src/test.qml</file>
<file alias="UdpSettings.qml">src/ui/preferences/UdpSettings.qml</file>
<file alias="VehicleSummary.qml">src/VehicleSetup/VehicleSummary.qml</file>
Expand Down
3 changes: 2 additions & 1 deletion src/Settings/App.SettingsGroup.json
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,8 @@
"shortDesc": "Host name",
"longDesc": "Host name to forward mavlink to. i.e: localhost:14445",
"type": "string",
"default": "localhost:14445"
"default": "localhost:14445",
"qgcRebootRequired": true
},
{
"name": "forwardMavlinkAPMSupportHostName",
Expand Down
6 changes: 6 additions & 0 deletions src/ui/SettingsPagesModel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ ListModel {
pageVisible: function() { return QGroundControl.settingsManager.videoSettings.visible }
}

ListElement {
name: qsTr("Telemetry")
url: "/qml/TelemetrySettings.qml"
pageVisible: function() { return true }
}

ListElement {
name: qsTr("ADSB Server")
url: "/qml/ADSBServerSettings.qml"
Expand Down
1 change: 1 addition & 0 deletions src/ui/preferences/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ add_custom_target(UiPreferencesQml
PlanViewSettings.qml
SerialSettings.qml
TcpSettings.qml
TelemetrySettings.qml
UdpSettings.qml
VideoSettings.qml
)
30 changes: 0 additions & 30 deletions src/ui/preferences/GeneralSettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ SettingsPage {
property Fact _userBrandImageIndoor: _brandImageSettings.userBrandImageIndoor
property Fact _userBrandImageOutdoor: _brandImageSettings.userBrandImageOutdoor
property Fact _appSavePath: _appSettings.savePath
property bool _disableAllDataPersistence: _appSettings.disableAllPersistence.rawValue

SettingsGroupLayout {
Layout.fillWidth: true
Expand Down Expand Up @@ -214,35 +213,6 @@ SettingsPage {
}
}

SettingsGroupLayout {
Layout.fillWidth: true
heading: qsTr("Telemetry Logging")
visible: !_disableAllDataPersistence

FactCheckBoxSlider {
Layout.fillWidth: true
text: qsTr("Save log after each flight")
fact: _telemetrySave
visible: fact.visible
property Fact _telemetrySave: _appSettings.telemetrySave
}
FactCheckBoxSlider {
Layout.fillWidth: true
text: qsTr("Save logs even if vehicle was not armed")
fact: _telemetrySaveNotArmed
visible: fact.visible
enabled: _appSettings.telemetrySave.rawValue
property Fact _telemetrySaveNotArmed: _appSettings.telemetrySaveNotArmed
}
FactCheckBoxSlider {
Layout.fillWidth: true
text: qsTr("Save CSV log of telemetry data")
fact: _saveCsvTelemetry
visible: fact.visible
property Fact _saveCsvTelemetry: _appSettings.saveCsvTelemetry
}
}

SettingsGroupLayout {
Layout.fillWidth: true
heading: qsTr("Brand Image")
Expand Down
222 changes: 222 additions & 0 deletions src/ui/preferences/TelemetrySettings.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,222 @@
/****************************************************************************
*
* (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/


import QtQuick
import QtQuick.Controls
import QtQuick.Dialogs
import QtQuick.Layouts

import QGroundControl
import QGroundControl.FactSystem
import QGroundControl.FactControls
import QGroundControl.Controls
import QGroundControl.ScreenTools
import QGroundControl.MultiVehicleManager
import QGroundControl.Palette

SettingsPage {
property var _settingsManager: QGroundControl.settingsManager
property var _appSettings: _settingsManager.appSettings
property bool _disableAllDataPersistence: _appSettings.disableAllPersistence.rawValue
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property string _notConnectedStr: qsTr("Not Connected")
property bool _isAPM: _activeVehicle ? _activeVehicle.apmFirmware : true
property bool _showAPMStreamRates: QGroundControl.apmFirmwareSupported && _settingsManager.apmMavlinkStreamRateSettings.visible && _isAPM
property var _apmStartMavlinkStreams: _appSettings.apmStartMavlinkStreams

SettingsGroupLayout {
Layout.fillWidth: true
heading: qsTr("Ground Station")

RowLayout {
Layout.fillWidth: true
spacing: ScreenTools.defaultFontPixelWidth * 2

QGCLabel {
Layout.fillWidth: true
text: qsTr("MAVLink System ID:")
}

QGCTextField {
text: QGroundControl.mavlinkSystemID.toString()
numericValuesOnly: true
onEditingFinished: {
console.log("text", text)
QGroundControl.mavlinkSystemID = parseInt(text)
}
}
}

QGCCheckBoxSlider {
Layout.fillWidth: true
text: qsTr("Emit heartbeat")
checked: QGroundControl.multiVehicleManager.gcsHeartBeatEnabled
onClicked: QGroundControl.multiVehicleManager.gcsHeartBeatEnabled = checked
}

QGCCheckBoxSlider {
Layout.fillWidth: true
text: qsTr("Only connect to vehicle with same MAVLink protocol version")
checked: QGroundControl.isVersionCheckEnabled
onClicked: QGroundControl.isVersionCheckEnabled = checked
}
}

SettingsGroupLayout {
Layout.fillWidth: true
heading: qsTr("MAVLink Forwarding")

FactCheckBoxSlider {
Layout.fillWidth: true
text: qsTr("Enable")
fact: _appSettings.forwardMavlink
visible: fact.visible
}

LabelledFactTextField {
Layout.fillWidth: true
textFieldPreferredWidth: ScreenTools.defaultFontPixelWidth * 20
label: qsTr("Host name")
fact: _appSettings.forwardMavlinkHostName
visible: fact.visible
enabled: _appSettings.forwardMavlink.rawValue
}
}

SettingsGroupLayout {
Layout.fillWidth: true
heading: qsTr("Logging")
visible: !_disableAllDataPersistence

FactCheckBoxSlider {
Layout.fillWidth: true
text: qsTr("Save log after each flight")
fact: _telemetrySave
visible: fact.visible
property Fact _telemetrySave: _appSettings.telemetrySave
}

FactCheckBoxSlider {
Layout.fillWidth: true
text: qsTr("Save logs even if vehicle was not armed")
fact: _telemetrySaveNotArmed
visible: fact.visible
enabled: _appSettings.telemetrySave.rawValue
property Fact _telemetrySaveNotArmed: _appSettings.telemetrySaveNotArmed
}

FactCheckBoxSlider {
Layout.fillWidth: true
text: qsTr("Save CSV log of telemetry data")
fact: _saveCsvTelemetry
visible: fact.visible
property Fact _saveCsvTelemetry: _appSettings.saveCsvTelemetry
}
}

SettingsGroupLayout {
Layout.fillWidth: true
heading: qsTr("Stream Rates (ArduPilot Only)")
visible: _showAPMStreamRates

QGCCheckBoxSlider {
id: controllerByVehicleCheckBox
Layout.fillWidth: true
text: qsTr("Controlled By vehicle")
checked: !_apmStartMavlinkStreams.rawValue
onClicked: _apmStartMavlinkStreams.rawValue = !checked
}

LabelledFactComboBox {
Layout.fillWidth: true
label: qsTr("Raw Sensors")
fact: _settingsManager.apmMavlinkStreamRateSettings.streamRateRawSensors
indexModel: false
enabled: !controllerByVehicleCheckBox.checked
}

LabelledFactComboBox {
Layout.fillWidth: true
label: qsTr("Extended Status")
fact: _settingsManager.apmMavlinkStreamRateSettings.streamRateExtendedStatus
indexModel: false
enabled: !controllerByVehicleCheckBox.checked
}

LabelledFactComboBox {
Layout.fillWidth: true
label: qsTr("RC Channels")
fact: _settingsManager.apmMavlinkStreamRateSettings.streamRateRCChannels
indexModel: false
enabled: !controllerByVehicleCheckBox.checked
}

LabelledFactComboBox {
Layout.fillWidth: true
label: qsTr("Position")
fact: _settingsManager.apmMavlinkStreamRateSettings.streamRatePosition
indexModel: false
enabled: !controllerByVehicleCheckBox.checked
}

LabelledFactComboBox {
Layout.fillWidth: true
label: qsTr("Extra 1")
fact: _settingsManager.apmMavlinkStreamRateSettings.streamRateExtra1
indexModel: false
enabled: !controllerByVehicleCheckBox.checked
}

LabelledFactComboBox {
Layout.fillWidth: true
label: qsTr("Extra 2")
fact: _settingsManager.apmMavlinkStreamRateSettings.streamRateExtra2
indexModel: false
enabled: !controllerByVehicleCheckBox.checked
}

LabelledFactComboBox {
Layout.fillWidth: true
label: qsTr("Extra 3")
fact: _settingsManager.apmMavlinkStreamRateSettings.streamRateExtra3
indexModel: false
enabled: !controllerByVehicleCheckBox.checked
}
}

SettingsGroupLayout {
Layout.fillWidth: true
heading: qsTr("Link Status (Current Vehicle))")

LabelledLabel {
Layout.fillWidth: true
label: qsTr("Total messages sent (computed)")
labelText: _activeVehicle ? _activeVehicle.mavlinkSentCount : _notConnectedStr
}

LabelledLabel {
Layout.fillWidth: true
label: qsTr("Total messages received")
labelText: _activeVehicle ? _activeVehicle.mavlinkReceivedCount : _notConnectedStr
}

LabelledLabel {
Layout.fillWidth: true
label: qsTr("Total message loss")
labelText: _activeVehicle ? _activeVehicle.mavlinkLossCount : _notConnectedStr
}

LabelledLabel {
Layout.fillWidth: true
label: qsTr("Loss rate:")
labelText: _activeVehicle ? _activeVehicle.mavlinkLossPercent.toFixed(0) + '%' : _notConnectedStr
}
}
}

0 comments on commit d4a5f80

Please sign in to comment.