Various changes have been made as a result of the discussion of the first version

This commit is contained in:
Yury Shuvakin
2022-09-09 16:36:44 +03:00
parent 1fc06361f8
commit 3d0f39f846
13 changed files with 259 additions and 68 deletions

View File

@@ -8,6 +8,8 @@ import Cubo 1.0
import Utils 1.0
Item {
id: root
Component {
id: cellListHeader
@@ -22,6 +24,7 @@ Item {
Layout.fillWidth: true
Controls.SubtitleLabel {
id: indexTitleLabel
text: qsTr("#")
color: Palette.tableHeaderTextColor
anchors.centerIn: parent
@@ -35,6 +38,7 @@ Item {
Layout.fillWidth: true
Controls.SubtitleLabel {
id: voltageTitleLabel
text: qsTr("Voltage")
color: Palette.tableHeaderTextColor
anchors.centerIn: parent
@@ -48,6 +52,7 @@ Item {
Layout.fillWidth: true
Controls.SubtitleLabel {
id: balancingTitleLabel
text: qsTr("Balancing")
color: Palette.tableHeaderTextColor
anchors.centerIn: parent
@@ -64,15 +69,16 @@ Item {
RowLayout {
spacing: 10
width: ListView.view.width
height: 38
height: 36
Item {
Layout.preferredWidth: parent.width / 6 - 20
Layout.preferredWidth: parent.width / 6 - 24
}
Controls.SubtitleLabel {
id: indexLabel
color: Palette.tableHeaderTextColor
horizontalAlignment: Text.AlignHCenter
Layout.preferredWidth: 25
Layout.alignment: Qt.AlignCenter
}
@@ -96,7 +102,7 @@ Item {
}
Item {
Layout.preferredWidth: parent.width / 6 - 20
Layout.preferredWidth: parent.width / 6 - 24
}
Component.onCompleted: {
@@ -157,12 +163,14 @@ Item {
Connections {
target: BmsInterface.commands()
enabled: root.visible
onCellsReceived: {
firstCellGroup.model = []
var firstModel = []
for (var i = 0; i < Math.min(cellCount, 16); ++i) {
firstModel.push({"voltage": MathHelper.roundDouble(cellVoltageArray[i]), "balancing": cellVoltageArray[i] < 0})
firstModel.push({"voltage": Math.abs(MathHelper.roundDouble(cellVoltageArray[i], 3)), "balancing": cellVoltageArray[i] < 0})
}
firstCellGroup.model = firstModel
@@ -171,7 +179,7 @@ Item {
var secondModel = []
for (var j = 16; j < Math.min(cellCount, 32); ++j) {
secondModel.push({"voltage": MathHelper.roundDouble(cellVoltageArray[j]), "balancing": cellVoltageArray[i] < 0})
secondModel.push({"voltage": Math.abs(MathHelper.roundDouble(cellVoltageArray[j], 3)), "balancing": cellVoltageArray[i] < 0})
}
secondCellGroup.model = secondModel
}
@@ -187,7 +195,7 @@ Item {
Timer {
id: refreshValuesTimer
interval: 5000
interval: 1000
onTriggered: getValues()
}