Cell balancing calculation added. Fixed rounding of real numbers to the second decimal place

This commit is contained in:
Yury Shuvakin
2022-08-26 09:30:07 +03:00
parent 6ae4386b37
commit 046d1f55ce
7 changed files with 34 additions and 14 deletions

View File

@@ -70,7 +70,7 @@ Item {
}
Controls.SubtitleLabel {
text: index + 1
id: indexLabel
color: Palette.tableHeaderTextColor
Layout.preferredWidth: 25
Layout.alignment: Qt.AlignCenter
@@ -97,6 +97,10 @@ Item {
Item {
Layout.preferredWidth: parent.width / 6 - 20
}
Component.onCompleted: {
indexLabel.text = index + ListView.view.indexOffset
}
}
}
@@ -113,6 +117,9 @@ Item {
clip: true
model: []
spacing: 0
boundsBehavior: Flickable.StopAtBounds
property int indexOffset: 1
header: cellListHeader
delegate: cellListDelegate
@@ -132,6 +139,9 @@ Item {
clip: true
model: []
spacing: 0
boundsBehavior: Flickable.StopAtBounds
property int indexOffset: 17
header: cellListHeader
delegate: cellListDelegate
@@ -149,7 +159,7 @@ Item {
var firstModel = []
for (var i = 0; i < Math.min(cellCount, 16); ++i) {
firstModel.push({"voltage": cellVoltageArray[i], "balancing": true})
firstModel.push({"voltage": MathHelper.roundDouble(cellVoltageArray[i]), "balancing": cellVoltageArray[i] < 0})
}
firstCellGroup.model = firstModel
@@ -158,7 +168,7 @@ Item {
var secondModel = []
for (var j = 16; j < Math.min(cellCount, 32); ++j) {
secondModel.push({"voltage": cellVoltageArray[j], "balancing": true})
secondModel.push({"voltage": MathHelper.roundDouble(cellVoltageArray[j]), "balancing": cellVoltageArray[i] < 0})
}
secondCellGroup.model = secondModel
}