Implemented AKB monitor screen

This commit is contained in:
Yury Shuvakin
2022-08-17 01:09:17 +03:00
parent dce22c65d6
commit a4196df821
9 changed files with 274 additions and 10 deletions

View File

@@ -7,4 +7,5 @@ Label {
color: Palette.contentTextColor
font.pixelSize: 18
font.weight: Font.Medium
elide: Text.ElideRight
}

View File

@@ -4,7 +4,8 @@ import QtQuick.Controls 2.12
import Utils 1.0
Label {
color: Palette.contentTextColor
color: Palette.textColor
font.pixelSize: 18
font.weight: Font.ExtraBold
elide: Text.ElideRight
}

View File

@@ -1,6 +1,18 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import Utils 1.0
TextField {
implicitHeight: 58
color: Palette.textColor
selectByMouse: true
selectionColor: Palette.alternativeBackgroundColor
background: Rectangle {
color: Palette.backgroundColor
border.color: Palette.borderColor
border.width: 1
radius: 8
}
}

View File

@@ -7,4 +7,5 @@ Label {
color: Palette.selectedTextColor
font.pixelSize: 28
font.weight: Font.ExtraBold
elide: Text.ElideRight
}

View File

@@ -4,6 +4,7 @@ import QtQuick.Layouts 1.12
import Controls 1.0 as Controls
import Screens 1.0 as Screens
import Cubo 1.0
import Utils 1.0
ApplicationWindow {
@@ -216,5 +217,10 @@ ApplicationWindow {
color: Palette.screenBackgroundColor
}
Component.onCompleted: connectionScreen.open()
Component.onCompleted: {
BmsInterface.bmsConfig().loadParamsXml("://res/config.xml")
BmsInterface.infoConfig().loadParamsXml("://res/info.xml")
connectionScreen.open()
}
}

View File

@@ -2,39 +2,54 @@ import QtQuick 2.12
import QtQuick.Layouts 1.12
import Controls 1.0 as Controls
import Cubo 1.0
Item {
ColumnLayout {
spacing: 15
anchors.fill: parent
Controls.Frame {
padding: 35
implicitWidth: parent.width
Layout.fillWidth: true
RowLayout {
spacing: 90
anchors.fill: parent
Controls.TitleLabel {
text: qsTr("Serial number")
Layout.fillWidth: true
Layout.maximumWidth: (parent.width - parent.spacing) / 2
}
Controls.TextField {
text: "AABBCCDD"
id: serialField
enabled: false
Layout.fillWidth: true
Layout.maximumWidth: (parent.width - parent.spacing) / 2
}
}
}
Controls.Frame {
padding: 35
implicitWidth: parent.width
Layout.fillWidth: true
GridLayout {
columns: 2
columnSpacing: 90
rowSpacing: 20
anchors.fill: parent
RowLayout {
spacing: 10
Controls.ContentLabel {
text: qsTr("Battery charge level, V")
Layout.fillWidth: true
Layout.maximumWidth: implicitWidth
}
Controls.DotSeparator {
@@ -42,15 +57,20 @@ Item {
}
Controls.SubtitleLabel {
id: batteryChargeLevelLabel
text: "-"
}
Layout.fillWidth: true
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
}
RowLayout {
spacing: 10
Controls.ContentLabel {
text: qsTr("Number of modules")
Layout.fillWidth: true
Layout.maximumWidth: implicitWidth
}
Controls.DotSeparator {
@@ -58,15 +78,20 @@ Item {
}
Controls.SubtitleLabel {
id: numberOfModulesLabel
text: "-"
}
Layout.fillWidth: true
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
}
RowLayout {
spacing: 10
Controls.ContentLabel {
text: qsTr("Battery voltage, V")
Layout.fillWidth: true
Layout.maximumWidth: implicitWidth
}
Controls.DotSeparator {
@@ -74,15 +99,20 @@ Item {
}
Controls.SubtitleLabel {
id: batteryVoltageLabel
text: "-"
}
Layout.fillWidth: true
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
}
RowLayout {
spacing: 10
Controls.ContentLabel {
text: qsTr("Number of cells")
Layout.fillWidth: true
Layout.maximumWidth: implicitWidth
}
Controls.DotSeparator {
@@ -90,10 +120,172 @@ Item {
}
Controls.SubtitleLabel {
id: numberOfCellsLabel
text: "-"
}
Layout.fillWidth: true
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
}
RowLayout {
spacing: 10
Controls.ContentLabel {
text: qsTr("Nominal capacity, A/h")
Layout.fillWidth: true
Layout.maximumWidth: implicitWidth
}
Controls.DotSeparator {
Layout.fillWidth: true
}
Controls.SubtitleLabel {
id: nominalCapacityLabel
text: "-"
}
Layout.fillWidth: true
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
}
RowLayout {
spacing: 10
Controls.ContentLabel {
text: qsTr("Actual capacity, A/h")
Layout.fillWidth: true
Layout.maximumWidth: implicitWidth
}
Controls.DotSeparator {
Layout.fillWidth: true
}
Controls.SubtitleLabel {
id: actualCapacityLabel
text: "-"
}
Layout.fillWidth: true
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
}
RowLayout {
spacing: 10
Controls.ContentLabel {
text: qsTr("Battery temperature, °C")
Layout.fillWidth: true
Layout.maximumWidth: implicitWidth
}
Controls.DotSeparator {
Layout.fillWidth: true
}
Controls.SubtitleLabel {
id: batteryTemperatureLabel
text: "-"
}
Layout.fillWidth: true
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
}
RowLayout {
spacing: 10
Controls.ContentLabel {
text: qsTr("BMS temperature, °C")
Layout.fillWidth: true
Layout.maximumWidth: implicitWidth
}
Controls.DotSeparator {
Layout.fillWidth: true
}
Controls.SubtitleLabel {
id: bmsTemperatureLabel
text: "-"
}
Layout.fillWidth: true
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
}
}
}
Controls.Frame {
padding: 35
implicitWidth: parent.width
Layout.fillWidth: true
GridLayout {
columns: 2
columnSpacing: 90
rowSpacing: 20
anchors.fill: parent
RowLayout {
spacing: 10
Controls.ContentLabel {
text: qsTr("Maximum cell voltage, V")
Layout.fillWidth: true
Layout.maximumWidth: implicitWidth
}
Controls.DotSeparator {
Layout.fillWidth: true
}
Controls.SubtitleLabel {
id: maximumCellVoltageLabel
text: "-"
}
Layout.fillWidth: true
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
}
RowLayout {
spacing: 10
Controls.ContentLabel {
text: qsTr("Minimum cell voltage, V")
Layout.fillWidth: true
Layout.maximumWidth: implicitWidth
}
Controls.DotSeparator {
Layout.fillWidth: true
}
Controls.SubtitleLabel {
id: minimumCellVoltageLabel
text: "-"
}
Layout.fillWidth: true
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
}
RowLayout {
spacing: 10
Controls.ContentLabel {
text: qsTr("Current")
Layout.fillWidth: true
Layout.maximumWidth: implicitWidth
}
Controls.DotSeparator {
Layout.fillWidth: true
}
Controls.SubtitleLabel {
id: currentLabel
text: "-"
}
Layout.fillWidth: true
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
}
}
}
@@ -102,4 +294,47 @@ Item {
Layout.fillHeight: true
}
}
Connections {
target: BmsInterface.commands()
onValuesReceived: {
batteryChargeLevelLabel.text = values.soC
batteryVoltageLabel.text = values.packVoltage
batteryTemperatureLabel.text = values.tempBattHigh
bmsTemperatureLabel.text = values.tempBMSHigh
maximumCellVoltageLabel.text = values.cVHigh
minimumCellVoltageLabel.text = values.cVLow
currentLabel.text = values.packCurrent
}
}
Connections {
target: BmsInterface.bmsConfig()
onUpdated: {
serialField.text = BmsInterface.bmsConfig().getParamDouble("notUsedCurrentThreshold")
numberOfModulesLabel.text = BmsInterface.bmsConfig().getParamInt("cellMonitorICCount")
numberOfCellsLabel.text = BmsInterface.bmsConfig().getParamInt("noOfCellsSeries")
nominalCapacityLabel.text = BmsInterface.bmsConfig().getParamDouble("batteryCapacity")
actualCapacityLabel.text = nominalCapacityLabel.text
}
}
Connections {
target: BmsInterface
onPortConnectedChanged: getValues()
}
onVisibleChanged: getValues()
function getValues() {
if (BmsInterface.isPortConnected() && visible) {
BmsInterface.commands().getValues()
BmsInterface.bmsConfig().updateDone()
}
}
}

View File

@@ -1,5 +1,13 @@
import QtQuick 2.0
import QtQuick 2.12
import QtQuick.Layouts 1.12
import Controls 1.0 as Controls
import Cubo 1.0
Item {
Controls.Frame {
anchors.fill: parent
}
}