Commit d732579a authored by Pierre TILAK's avatar Pierre TILAK

Add settings, add lock north

- Add setting for Heading to Next WP and Nort Up lock
- Add check for vehicle for every indicator to avoid showig them while
  no vehicle
parent e5b5b95c
...@@ -45,20 +45,26 @@ Item { ...@@ -45,20 +45,26 @@ Item {
return false return false
} }
else{ else{
return true return vehicle
} }
} }
function isHeadingAngleOK(){ function isHeadingAngleOK(){
return _showHomeHeadingCompass && !isNaN(_headingToHome) return vehicle && _showHomeHeadingCompass && !isNaN(_headingToHome)
} }
function isHeadingToNextWPOK(){ function isHeadingToNextWPOK(){
return !isNaN(_headingToNextWP) return vehicle && _showHeadingToNextWP && !isNaN(_headingToNextWP)
}
function isNorthUpLocked(){
return _lockNorthUpCompass
} }
readonly property bool _showHomeHeadingCompass: QGroundControl.settingsManager.flyViewSettings.showHomeHeadingCompass.value readonly property bool _showHomeHeadingCompass: QGroundControl.settingsManager.flyViewSettings.showHomeHeadingCompass.value
readonly property bool _showCOGAngleCompass: QGroundControl.settingsManager.flyViewSettings.showCOGAngleCompass.value readonly property bool _showCOGAngleCompass: QGroundControl.settingsManager.flyViewSettings.showCOGAngleCompass.value
readonly property bool _showHeadingToNextWP: QGroundControl.settingsManager.flyViewSettings.showHeadingToNextWP.value
readonly property bool _lockNorthUpCompass: QGroundControl.settingsManager.flyViewSettings.lockNorthUpCompass.value
QGCPalette { id: qgcPal; colorGroupEnabled: enabled } QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
...@@ -85,9 +91,10 @@ Item { ...@@ -85,9 +91,10 @@ Item {
sourceSize.height: parent.height sourceSize.height: parent.height
transform: Rotation { transform: Rotation {
property var _angle: isNorthUpLocked()?_headingToNextWP-_heading:_headingToNextWP
origin.x: cOGPointer.width / 2 origin.x: cOGPointer.width / 2
origin.y: cOGPointer.height / 2 origin.y: cOGPointer.height / 2
angle: _headingToNextWP - _heading angle: _angle
} }
} }
...@@ -100,9 +107,10 @@ Item { ...@@ -100,9 +107,10 @@ Item {
sourceSize.height: parent.height sourceSize.height: parent.height
transform: Rotation { transform: Rotation {
property var _angle:isNorthUpLocked()?_courseOverGround-_heading:_courseOverGround
origin.x: cOGPointer.width / 2 origin.x: cOGPointer.width / 2
origin.y: cOGPointer.height / 2 origin.y: cOGPointer.height / 2
angle: _courseOverGround - _heading angle: _angle
} }
} }
...@@ -114,6 +122,11 @@ Item { ...@@ -114,6 +122,11 @@ Item {
sourceSize.width: width sourceSize.width: width
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
anchors.centerIn: parent anchors.centerIn: parent
transform: Rotation {
origin.x: pointer.width / 2
origin.y: pointer.height / 2
angle: isNorthUpLocked()?0:_heading
}
} }
Image { Image {
...@@ -127,8 +140,9 @@ Item { ...@@ -127,8 +140,9 @@ Item {
visible: _showHomeHeadingCompass visible: _showHomeHeadingCompass
transform: Translate { transform: Translate {
x: size/2.3 * Math.sin((-_heading + _headingToHome)*(3.14/180)) property double _angle: isNorthUpLocked()?-_heading+_headingToHome:_headingToHome
y: - size/2.3 * Math.cos((-_heading + _headingToHome)*(3.14/180)) x: size/2.3 * Math.sin((_angle)*(3.14/180))
y: - size/2.3 * Math.cos((_angle)*(3.14/180))
} }
} }
...@@ -143,7 +157,7 @@ Item { ...@@ -143,7 +157,7 @@ Item {
transform: Rotation { transform: Rotation {
origin.x: compassDial.width / 2 origin.x: compassDial.width / 2
origin.y: compassDial.height / 2 origin.y: compassDial.height / 2
angle: -_heading angle: isNorthUpLocked()?-_heading:0
} }
} }
......
...@@ -27,14 +27,26 @@ ...@@ -27,14 +27,26 @@
}, },
{ {
"name": "showHomeHeadingCompass", "name": "showHomeHeadingCompass",
"shortDescription": "Show/Hide Home heading on the Compass", "shortDescription": "Show/Hide Home heading on Compass",
"type": "bool", "type": "bool",
"defaultValue": false "defaultValue": false
}, },
{ {
"name": "showCOGAngleCompass", "name": "showCOGAngleCompass",
"shortDescription": "Show/Hide Course Over Ground angle on the Compass", "shortDescription": "Show/Hide Course Over Ground angle on Compass",
"type": "bool", "type": "bool",
"defaultValue": false "defaultValue": false
},
{
"name": "showHeadingToNextWP",
"shortDescription": "Show/Hide Heading to Next Waypoint on Compass",
"type": "bool",
"defaultValue": false
},
{
"name": "lockNorthUpCompass",
"shortDescription": "Lock North up on Compass",
"type": "bool",
"defaultValue": true
} }
] ]
...@@ -23,3 +23,5 @@ DECLARE_SETTINGSFACT(FlyViewSettings, showLogReplayStatusBar) ...@@ -23,3 +23,5 @@ DECLARE_SETTINGSFACT(FlyViewSettings, showLogReplayStatusBar)
DECLARE_SETTINGSFACT(FlyViewSettings, alternateInstrumentPanel) DECLARE_SETTINGSFACT(FlyViewSettings, alternateInstrumentPanel)
DECLARE_SETTINGSFACT(FlyViewSettings, showHomeHeadingCompass) DECLARE_SETTINGSFACT(FlyViewSettings, showHomeHeadingCompass)
DECLARE_SETTINGSFACT(FlyViewSettings, showCOGAngleCompass) DECLARE_SETTINGSFACT(FlyViewSettings, showCOGAngleCompass)
DECLARE_SETTINGSFACT(FlyViewSettings, showHeadingToNextWP)
DECLARE_SETTINGSFACT(FlyViewSettings, lockNorthUpCompass)
...@@ -25,4 +25,6 @@ public: ...@@ -25,4 +25,6 @@ public:
DEFINE_SETTINGFACT(alternateInstrumentPanel) DEFINE_SETTINGFACT(alternateInstrumentPanel)
DEFINE_SETTINGFACT(showHomeHeadingCompass) DEFINE_SETTINGFACT(showHomeHeadingCompass)
DEFINE_SETTINGFACT(showCOGAngleCompass) DEFINE_SETTINGFACT(showCOGAngleCompass)
DEFINE_SETTINGFACT(showHeadingToNextWP)
DEFINE_SETTINGFACT(lockNorthUpCompass)
}; };
...@@ -3810,8 +3810,6 @@ void Vehicle::_updateHeadingToNextWP(void) ...@@ -3810,8 +3810,6 @@ void Vehicle::_updateHeadingToNextWP(void)
else{ else{
_headingToNextWPFact.setRawValue(qQNaN()); _headingToNextWPFact.setRawValue(qQNaN());
} }
qDebug() << " Vehicle updateHeadingToNextWP "<< _currentIndex;
} }
void Vehicle::_updateDistanceToGCS(void) void Vehicle::_updateDistanceToGCS(void)
......
...@@ -476,19 +476,33 @@ Rectangle { ...@@ -476,19 +476,33 @@ Rectangle {
property Fact _alternateInstrumentPanel: QGroundControl.settingsManager.flyViewSettings.alternateInstrumentPanel property Fact _alternateInstrumentPanel: QGroundControl.settingsManager.flyViewSettings.alternateInstrumentPanel
} }
FactCheckBox { FactCheckBox {
text: qsTr("Show/Hide Home heading on the Compass") text: qsTr("Show/Hide Home heading on Compass")
visible: _showHomeHeadingCompass.visible visible: _showHomeHeadingCompass.visible
fact: _showHomeHeadingCompass fact: _showHomeHeadingCompass
property Fact _showHomeHeadingCompass: QGroundControl.settingsManager.flyViewSettings.showHomeHeadingCompass property Fact _showHomeHeadingCompass: QGroundControl.settingsManager.flyViewSettings.showHomeHeadingCompass
} }
FactCheckBox { FactCheckBox {
text: qsTr("Show/Hide Course Over Ground angle on the Compass") text: qsTr("Show/Hide Course Over Ground angle on Compass")
visible: _showCOGAngleCompass.visible visible: _showCOGAngleCompass.visible
fact: _showCOGAngleCompass fact: _showCOGAngleCompass
property Fact _showCOGAngleCompass: QGroundControl.settingsManager.flyViewSettings.showCOGAngleCompass property Fact _showCOGAngleCompass: QGroundControl.settingsManager.flyViewSettings.showCOGAngleCompass
} }
FactCheckBox {
text: qsTr("Show/Hide Heading to Next Waypoint on Compass")
visible: _showHeadingToNextWP.visible
fact: _showHeadingToNextWP
property Fact _showHeadingToNextWP: QGroundControl.settingsManager.flyViewSettings.showHeadingToNextWP
}
FactCheckBox {
text: qsTr("Lock North up on Compass")
visible: _lockNorthUpCompass.visible
fact: _lockNorthUpCompass
property Fact _lockNorthUpCompass: QGroundControl.settingsManager.flyViewSettings.lockNorthUpCompass
}
GridLayout { GridLayout {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment