Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions qgcimages.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@
<file alias="Gps.svg">src/UI/toolbar/Images/Gps.svg</file>
<file alias="Hamburger.svg">src/UI/toolbar/Images/Hamburger.svg</file>
<file alias="HamburgerThin.svg">src/UI/toolbar/Images/HamburgerThin.svg</file>
<file alias="GpsAuthentication.svg">src/UI/toolbar/Images/GpsAuthentication.svg</file>
<file alias="GpsInterference.svg">src/UI/toolbar/Images/GpsInterference.svg</file>
<file alias="Help.svg">src/FlightMap/Images/Help.svg</file>
<file alias="HelpBlack.svg">src/FlightMap/Images/HelpBlack.svg</file>
<file alias="HITL.svg">src/AutoPilotPlugins/PX4/Images/HITL.svg</file>
Expand Down
29 changes: 14 additions & 15 deletions src/Comms/MockLink/MockLink.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1357,23 +1357,22 @@ void MockLink::_sendGpsRawInt()
_vehicleComponentId,
mavlinkChannel(),
&msg,
timeTick++, // time since boot
timeTick++, // time since boot
GPS_FIX_TYPE_3D_FIX,
static_cast<int32_t>(_vehicleLatitude * 1E7),
static_cast<int32_t>(_vehicleLongitude * 1E7),
static_cast<int32_t>(_vehicleAltitudeAMSL * 1000),
3 * 100, // hdop
3 * 100, // vdop
UINT16_MAX, // velocity not known
UINT16_MAX, // course over ground not known
8, // satellites visible
(int32_t)(_vehicleLatitude * 1E7),
(int32_t)(_vehicleLongitude * 1E7),
(int32_t)(_vehicleAltitudeAMSL * 1000),
UINT16_MAX, UINT16_MAX, // HDOP/VDOP not known
UINT16_MAX, // velocity not known
UINT16_MAX, // course over ground not known
8, // satellites visible
//-- Extension
0, // Altitude (above WGS84, EGM96 ellipsoid), in meters * 1000 (positive for up).
0, // Position uncertainty in meters * 1000 (positive for up).
0, // Altitude uncertainty in meters * 1000 (positive for up).
0, // Speed uncertainty in meters * 1000 (positive for up).
0, // Heading / track uncertainty in degrees * 1e5.
65535 // Yaw not provided
0, // Altitude (above WGS84, EGM96 ellipsoid), in meters * 1000 (positive for up).
0, // Position uncertainty in meters * 1000 (positive for up).
0, // Altitude uncertainty in meters * 1000 (positive for up).
0, // Speed uncertainty in meters * 1000 (positive for up).
0, // Heading / track uncertainty in degrees * 1e5.
65535 // Yaw not provided
);
respondWithMavlinkMessage(msg);
}
Expand Down
2 changes: 2 additions & 0 deletions src/FirmwarePlugin/FirmwarePlugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ const QVariantList &FirmwarePlugin::toolIndicators(const Vehicle*)
_toolIndicatorList = QVariantList({
QVariant::fromValue(QUrl::fromUserInput("qrc:/qml/QGroundControl/Controls/FlightModeIndicator.qml")),
QVariant::fromValue(QUrl::fromUserInput("qrc:/qml/QGroundControl/Toolbar/VehicleGPSIndicator.qml")),
QVariant::fromValue(QUrl::fromUserInput("qrc:/qml/QGroundControl/Toolbar/GPSInterferenceIndicator.qml")),
QVariant::fromValue(QUrl::fromUserInput("qrc:/qml/QGroundControl/Toolbar/GPSAuthenticationIndicator.qml")),
QVariant::fromValue(QUrl::fromUserInput("qrc:/qml/QGroundControl/Toolbar/TelemetryRSSIIndicator.qml")),
QVariant::fromValue(QUrl::fromUserInput("qrc:/qml/QGroundControl/Toolbar/RCRSSIIndicator.qml")),
QVariant::fromValue(QUrl::fromUserInput("qrc:/qml/QGroundControl/Controls/BatteryIndicator.qml")),
Expand Down
27 changes: 27 additions & 0 deletions src/QmlControls/GPSIndicatorPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,27 @@ ToolIndicatorPage {
}


function errorText() {
if(!_activeVehicle){
return qsTr("Disconnected")
} else if (_activeVehicle.gps.systemErrors.value === 1) {
return qsTr("Incoming correction")
} else if (_activeVehicle.gps.systemErrors.value === 2) {
return qsTr("Configuration")
} else if (_activeVehicle.gps.systemErrors.value === 4) {
return qsTr("Software")
} else if (_activeVehicle.gps.systemErrors.value === 8) {
return qsTr("Antenna")
} else if (_activeVehicle.gps.systemErrors.value === 16) {
return qsTr("Event congestion")
} else if (_activeVehicle.gps.systemErrors.value === 32) {
return qsTr("CPU overload")
} else if (_activeVehicle.gps.systemErrors.value === 64) {
return qsTr("Output congestion")
}
return qsTr("Multiple errors")
}

contentComponent: Component {
ColumnLayout {
spacing: ScreenTools.defaultFontPixelHeight / 2
Expand Down Expand Up @@ -96,6 +117,12 @@ ToolIndicatorPage {
label: qsTr("Course Over Ground")
labelText: activeVehicle ? activeVehicle.gps.courseOverGround.valueString : valueNA
}

LabelledLabel {
label: qsTr("GPS Error")
labelText: errorText()
visible: _activeVehicle && _activeVehicle.gps.systemErrors.value > 0
}
}

SettingsGroupLayout {
Expand Down
1 change: 1 addition & 0 deletions src/QmlControls/QGCPalette.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ void QGCPalette::_buildMap()
DECLARE_QGC_COLOR(colorRed, "#b52b2b", "#b52b2b", "#f32836", "#f32836")
DECLARE_QGC_COLOR(colorGrey, "#808080", "#808080", "#bfbfbf", "#bfbfbf")
DECLARE_QGC_COLOR(colorBlue, "#1a72ff", "#1a72ff", "#536dff", "#536dff")
DECLARE_QGC_COLOR(colorWhite, "#222222", "#222222", "#ffffff", "#ffffff")
DECLARE_QGC_COLOR(alertBackground, "#eecc44", "#eecc44", "#eecc44", "#eecc44")
DECLARE_QGC_COLOR(alertBorder, "#808080", "#808080", "#808080", "#808080")
DECLARE_QGC_COLOR(alertText, "#000000", "#000000", "#000000", "#000000")
Expand Down
1 change: 1 addition & 0 deletions src/QmlControls/QGCPalette.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ class QGCPalette : public QObject
DEFINE_QGC_COLOR(colorRed, setColorRed)
DEFINE_QGC_COLOR(colorGrey, setColorGrey)
DEFINE_QGC_COLOR(colorBlue, setColorBlue)
DEFINE_QGC_COLOR(colorWhite, setColorWhite)
DEFINE_QGC_COLOR(alertBackground, setAlertBackground)
DEFINE_QGC_COLOR(alertBorder, setAlertBorder)
DEFINE_QGC_COLOR(alertText, setAlertText)
Expand Down
2 changes: 2 additions & 0 deletions src/UI/toolbar/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ qt_add_qml_module(ToolbarModule
EscIndicatorPage.qml
GCSControlIndicator.qml
GimbalIndicator.qml
GPSAuthenticationIndicator.qml
GPSInterferenceIndicator.qml
JoystickIndicator.qml
LinkIndicator.qml
ModeIndicator.qml
Expand Down
84 changes: 84 additions & 0 deletions src/UI/toolbar/GPSAuthenticationIndicator.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/****************************************************************************
*
* (c) 2009-2024 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.Layouts

import QGroundControl
import QGroundControl.Controls
import QGroundControl.ScreenTools
import QGroundControl.Palette

//-------------------------------------------------------------------------
//-- GPS Authentication Indicator
Item {
id: control
width: height
anchors.top: parent.top
anchors.bottom: parent.bottom

property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle

property bool showIndicator: _activeVehicle && _activeVehicle.gps.authenticationState.value > 0

function authenticationIconColor() {
if(!_activeVehicle){
return qgcPal.colorGrey // Not connected
}

switch (_activeVehicle.gps.authenticationState.value) {
case 1: // Initializing
return qgcPal.colorYellow;
case 2: // Error
return qgcPal.colorRed;
case 3: // OK
return qgcPal.colorGreen;
case 0: // Unknown
case 4: // Disabled
default:
return qgcPal.colorGrey;
}
}

QGCColoredImage {
id: gpsAuthenticationIcon
width: height
anchors.top: parent.top
anchors.bottom: parent.bottom
source: "/qmlimages/GpsAuthentication.svg"
fillMode: Image.PreserveAspectFit
sourceSize.height: height
opacity: 1
color: authenticationIconColor()
}

MouseArea {
anchors.fill: parent
onClicked: mainWindow.showIndicatorDrawer(authenticationContentComponent, control)
}

Component{
id: authenticationContentComponent

ColumnLayout{
spacing: ScreenTools.defaultFontPixelHeight / 2

SettingsGroupLayout {
heading: qsTr("GPS Authentication")
contentSpacing: 0
showDividers: false

LabelledLabel {
label: qsTr("Status")
labelText: _activeVehicle ? (_activeVehicle.gps.authenticationState.valueString || qsTr("n/a")) : qsTr("n/a")
}
}
}
}
}
95 changes: 95 additions & 0 deletions src/UI/toolbar/GPSInterferenceIndicator.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
/****************************************************************************
*
* (c) 2009-2024 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.Layouts

import QGroundControl
import QGroundControl.Controls
import QGroundControl.ScreenTools
import QGroundControl.Palette

//-------------------------------------------------------------------------
//-- GPS Interference Indicator
Item {
id: control
width: height
anchors.top: parent.top
anchors.bottom: parent.bottom

property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle

property bool showIndicator: _activeVehicle && (_activeVehicle.gps.spoofingState.value > 0 || _activeVehicle.gps.jammingState.value > 0)

QGCColoredImage {
id: gpsSpoofingIcon
width: height
anchors.top: parent.top
anchors.bottom: parent.bottom
source: "/qmlimages/GpsInterference.svg"
fillMode: Image.PreserveAspectFit
sourceSize.height: height
opacity: 1
color: {
if(!_activeVehicle){
return qgcPal.colorGrey
}

let maxState = Math.max(_activeVehicle.gps.spoofingState.value, _activeVehicle.gps.jammingState.value);

switch (maxState) {
case 3:
return qgcPal.colorRed;
case 2:
return qgcPal.colorOrange;
case 1:
return qgcPal.colorWhite;
default:
return qgcPal.colorGrey;
}
}
}

MouseArea {
anchors.fill: parent
onClicked: mainWindow.showIndicatorDrawer(gpsSpoofingPopup, control)
}

Component {
id: gpsSpoofingPopup

ToolIndicatorPage {
showExpand: expandedComponent ? true : false
contentComponent: spoofingContentComponent
}
}

Component{
id: spoofingContentComponent

ColumnLayout{
spacing: ScreenTools.defaultFontPixelHeight / 2

SettingsGroupLayout {
heading: qsTr("GPS Interference Status")
showDividers: true

LabelledLabel {
label: qsTr("GPS Jamming")
labelText: _activeVehicle ? (_activeVehicle.gps.jammingState.valueString || qsTr("n/a")) : qsTr("n/a")
}

LabelledLabel {
label: qsTr("GPS Spoofing")
labelText: _activeVehicle ? (_activeVehicle.gps.spoofingState.valueString || qsTr("n/a")) : qsTr("n/a")
}
}
}
}
}
4 changes: 4 additions & 0 deletions src/UI/toolbar/Images/GpsAuthentication.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
80 changes: 80 additions & 0 deletions src/UI/toolbar/Images/GpsInterference.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading