Skip to content

Commit

Permalink
Merge pull request #5135 from bluerobotics/vehicle-health-alert
Browse files Browse the repository at this point in the history
Rework vehicle sensors_health alert
  • Loading branch information
DonLakeFlyer authored Aug 8, 2017
2 parents 9cb4f2d + b25fa29 commit 42a2e61
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 8 deletions.
4 changes: 4 additions & 0 deletions src/FlightMap/Widgets/InstrumentSwipeView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ Item {
showPage(_currentPage)
}

function currentPage() {
return _currentPage
}

MouseArea {
anchors.fill: parent
onClicked: showNextPage()
Expand Down
31 changes: 31 additions & 0 deletions src/FlightMap/Widgets/QGCInstrumentWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,37 @@ Rectangle {
onClicked: _valuesWidget.showPicker()
}
}

Image {
id: healthWarning
anchors.bottom: outerCompass.bottom
anchors.left: outerCompass.left
source: "/qmlimages/Yield.svg"
mipmap: true
visible: _activeVehicle ? !_warningsViewed && _activeVehicle.unhealthySensors.length > 0 && _valuesWidget.currentPage() != 2 : false
opacity: 0.8
width: outerCompass.width * 0.15
sourceSize.width: width
fillMode: Image.PreserveAspectFit

property bool _warningsViewed: false

MouseArea {
anchors.fill: parent
hoverEnabled: true
onEntered: healthWarning.opacity = 1
onExited: healthWarning.opacity = 0.8
onClicked: {
_valuesWidget.showPage(2)
healthWarning._warningsViewed = true
}
}

Connections {
target: _activeVehicle
onUnhealthySensorsChanged: healthWarning._warningsViewed = false
}
}
}

Rectangle {
Expand Down
7 changes: 0 additions & 7 deletions src/FlightMap/Widgets/VehicleHealthWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,6 @@ QGCFlickable {

property var unhealthySensors: QGroundControl.multiVehicleManager.activeVehicle ? QGroundControl.multiVehicleManager.activeVehicle.unhealthySensors : [ ]

// Any time the unhealthy sensors list changes, switch to the health page
onUnhealthySensorsChanged: {
if (unhealthySensors.length != 0) {
showPage(2)
}
}

MouseArea {
anchors.fill: parent
onClicked: showNextPage()
Expand Down
2 changes: 1 addition & 1 deletion src/FlightMap/Widgets/VibrationWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ QGCFlickable {
}

QGCLabel {
text: qsTr("Accel 2: ") + (_activeVehicle ? _activeVehicle.vibration.clipCount3.valueString : "")
text: qsTr("Accel 3: ") + (_activeVehicle ? _activeVehicle.vibration.clipCount3.valueString : "")
color: textColor
}
}
Expand Down

0 comments on commit 42a2e61

Please sign in to comment.