Added validators for various configuration settings. Implemented reading the configuration and loading the default configuration

This commit is contained in:
Yury Shuvakin
2022-08-23 01:33:17 +03:00
parent eda44940d3
commit 8abae06275
2 changed files with 55 additions and 1 deletions

View File

@@ -334,7 +334,7 @@ Item {
function getValues() {
if (BmsInterface.isPortConnected() && visible) {
BmsInterface.commands().getValues()
BmsInterface.bmsConfig().updateDone()
BmsInterface.commands().getBMSconf()
}
}
}

View File

@@ -78,12 +78,14 @@ RowLayout {
Controls.TextField {
id: numberOfBoardsField
validator: IntValidator {}
Layout.fillWidth: true
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
}
Controls.TextField {
id: numberOfCellsField
validator: IntValidator {}
Layout.fillWidth: true
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
}
@@ -124,12 +126,14 @@ RowLayout {
Controls.TextField {
id: numberOfParallelCellsField
validator: IntValidator {}
Layout.fillWidth: true
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
}
Controls.TextField {
id: batteryCapacityField
validator: DoubleValidator {}
Layout.fillWidth: true
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
}
@@ -168,12 +172,14 @@ RowLayout {
Controls.TextField {
id: maximumChargeCurrentField
validator: DoubleValidator {}
Layout.fillWidth: true
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
}
Controls.TextField {
id: maximumLoadCurrentField
validator: DoubleValidator {}
Layout.fillWidth: true
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
}
@@ -187,6 +193,7 @@ RowLayout {
Controls.TextField {
id: maximumTemperatureField
validator: DoubleValidator {}
Layout.fillWidth: true
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
Layout.columnSpan: 2
@@ -226,12 +233,14 @@ RowLayout {
Controls.TextField {
id: lowerShutdownThresholdField
validator: DoubleValidator {}
Layout.fillWidth: true
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
}
Controls.TextField {
id: upperShutdownThresholdField
validator: DoubleValidator {}
Layout.fillWidth: true
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
}
@@ -299,12 +308,14 @@ RowLayout {
Controls.TextField {
id: balancingStartVoltageField
validator: DoubleValidator {}
Layout.fillWidth: true
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
}
Controls.TextField {
id: balancingStartDeltaVoltageField
validator: DoubleValidator {}
Layout.fillWidth: true
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
}
@@ -509,6 +520,7 @@ RowLayout {
Controls.TextField {
id: zeroSensorValueField
validator: DoubleValidator {}
Layout.fillWidth: true
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
Layout.columnSpan: 2
@@ -586,11 +598,13 @@ RowLayout {
Controls.OutlineButton {
text: qsTr("Read settings from file")
Layout.fillWidth: true
onClicked: BmsInterface.commands().getBMSconfDefault()
}
Controls.OutlineButton {
text: qsTr("Read current settings from BMS")
Layout.fillWidth: true
onClicked: BmsInterface.commands().getBMSconf()
}
Controls.OutlineButton {
@@ -609,4 +623,44 @@ RowLayout {
Layout.maximumWidth: 320
Layout.fillHeight: true
}
Connections {
target: BmsInterface.bmsConfig()
onUpdated: {
serialNumberField.text = BmsInterface.bmsConfig().getParamDouble("notUsedCurrentThreshold")
numberOfBoardsField.text = BmsInterface.bmsConfig().getParamInt("cellMonitorICCount")
numberOfCellsField.text = BmsInterface.bmsConfig().getParamInt("noOfCellsSeries")
numberOfParallelCellsField.text = BmsInterface.bmsConfig().getParamInt("noOfCellsParallel")
batteryCapacityField.text = BmsInterface.bmsConfig().getParamDouble("batteryCapacity")
maximumChargeCurrentField.text = BmsInterface.bmsConfig().getParamDouble("maxAllowedCurrent")
maximumLoadCurrentField.text = BmsInterface.bmsConfig().getParamDouble("maxMismatchThreshold")
maximumTemperatureField.text = BmsInterface.bmsConfig().getParamDouble("allowedTempBattChargingMax")
// TODO
lowerShutdownThresholdField.text = BmsInterface.bmsConfig().getParamDouble("cellHardUnderVoltage")
upperShutdownThresholdField.text = BmsInterface.bmsConfig().getParamDouble("cellHardOverVoltage")
// TODO
balancingStartVoltageField.text = BmsInterface.bmsConfig().getParamDouble("cellBalanceStart")
balancingStartDeltaVoltageField.text = BmsInterface.bmsConfig().getParamDouble("cellBalanceDifferenceThreshold")
zeroSensorValueField.text = BmsInterface.bmsConfig().getParamDouble("shuntLCFactor")
}
}
Connections {
target: BmsInterface
onPortConnectedChanged: getValues()
}
onVisibleChanged: getValues()
function getValues() {
if (BmsInterface.isPortConnected() && visible) {
BmsInterface.bmsConfig().updateDone()
}
}
}