Added fault state popup
This commit is contained in:
@@ -353,11 +353,16 @@ ApplicationWindow {
|
||||
onPortConnectedChanged: {
|
||||
connectionStatusLabel.text = Qt.binding(function(){ return BmsInterface.isPortConnected() ? qsTr("Connected") : qsTr("Disconnected") })
|
||||
connectionStatusIndicator.enabled = BmsInterface.isPortConnected()
|
||||
faultStateTimer.running = BmsInterface.isPortConnected()
|
||||
|
||||
if (BmsInterface.isPortConnected()) {
|
||||
BmsInterface.commands().getBMSconf()
|
||||
BmsInterface.commands().getFaultState()
|
||||
} else {
|
||||
serialLabel.text = "-"
|
||||
firmwareLabel.text = "-"
|
||||
statusPopup.queue = []
|
||||
faultStatePopup.lastState = ""
|
||||
}
|
||||
}
|
||||
|
||||
@@ -419,6 +424,17 @@ ApplicationWindow {
|
||||
onFwVersionReceived: {
|
||||
firmwareLabel.text = major + "." + minor
|
||||
}
|
||||
onFaultStateReceived: {
|
||||
if (faultStatePopup.lastState != faultString) {
|
||||
faultStatePopup.close()
|
||||
faultStatePopup.lastState = faultString
|
||||
faultStatePopup.text = faultString
|
||||
faultStatePopup.type = faultType
|
||||
faultStatePopup.open()
|
||||
|
||||
Qt.callLater(debugScreen.printMessage, faultString, faultStatePopup.color)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Screens.ConnectionDialog {
|
||||
@@ -457,12 +473,12 @@ ApplicationWindow {
|
||||
onOpened: {
|
||||
hideStatusTimer.start()
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: hideStatusTimer
|
||||
interval: 3000
|
||||
onTriggered: statusPopup.close()
|
||||
Timer {
|
||||
id: hideStatusTimer
|
||||
interval: 3000
|
||||
onTriggered: statusPopup.close()
|
||||
}
|
||||
}
|
||||
|
||||
Popup {
|
||||
@@ -505,6 +521,12 @@ ApplicationWindow {
|
||||
|
||||
onOpened: hideBusyTimer.start()
|
||||
onClosed: hideBusyTimer.stop()
|
||||
|
||||
Timer {
|
||||
id: hideBusyTimer
|
||||
interval: 30000
|
||||
onTriggered: busyPopup.close()
|
||||
}
|
||||
}
|
||||
|
||||
Popup {
|
||||
@@ -549,10 +571,29 @@ ApplicationWindow {
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: hideBusyTimer
|
||||
interval: 30000
|
||||
onTriggered: busyPopup.close()
|
||||
Screens.StatePopup {
|
||||
id: faultStatePopup
|
||||
x: parent.width - width - 45
|
||||
y: 18
|
||||
|
||||
property var lastState: ""
|
||||
|
||||
onOpened: {
|
||||
hideStateTimer.start()
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: hideStateTimer
|
||||
interval: 3000
|
||||
onTriggered: faultStatePopup.close()
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: faultStateTimer
|
||||
interval: 50000
|
||||
repeat: true
|
||||
onTriggered: BmsInterface.commands().getFaultState()
|
||||
}
|
||||
}
|
||||
|
||||
background: Rectangle {
|
||||
@@ -561,6 +602,6 @@ ApplicationWindow {
|
||||
|
||||
Component.onCompleted: {
|
||||
connectionDialog.open()
|
||||
Qt.callLater(debugScreen.printMessage, qsTr("Tool started"), true)
|
||||
Qt.callLater(debugScreen.printMessage, qsTr("Tool started"))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user