Added validators for various configuration settings. Implemented reading the configuration and loading the default configuration
This commit is contained in:
@@ -334,7 +334,7 @@ Item {
|
|||||||
function getValues() {
|
function getValues() {
|
||||||
if (BmsInterface.isPortConnected() && visible) {
|
if (BmsInterface.isPortConnected() && visible) {
|
||||||
BmsInterface.commands().getValues()
|
BmsInterface.commands().getValues()
|
||||||
BmsInterface.bmsConfig().updateDone()
|
BmsInterface.commands().getBMSconf()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,12 +78,14 @@ RowLayout {
|
|||||||
|
|
||||||
Controls.TextField {
|
Controls.TextField {
|
||||||
id: numberOfBoardsField
|
id: numberOfBoardsField
|
||||||
|
validator: IntValidator {}
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
|
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
|
||||||
}
|
}
|
||||||
|
|
||||||
Controls.TextField {
|
Controls.TextField {
|
||||||
id: numberOfCellsField
|
id: numberOfCellsField
|
||||||
|
validator: IntValidator {}
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
|
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
|
||||||
}
|
}
|
||||||
@@ -124,12 +126,14 @@ RowLayout {
|
|||||||
|
|
||||||
Controls.TextField {
|
Controls.TextField {
|
||||||
id: numberOfParallelCellsField
|
id: numberOfParallelCellsField
|
||||||
|
validator: IntValidator {}
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
|
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
|
||||||
}
|
}
|
||||||
|
|
||||||
Controls.TextField {
|
Controls.TextField {
|
||||||
id: batteryCapacityField
|
id: batteryCapacityField
|
||||||
|
validator: DoubleValidator {}
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
|
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
|
||||||
}
|
}
|
||||||
@@ -168,12 +172,14 @@ RowLayout {
|
|||||||
|
|
||||||
Controls.TextField {
|
Controls.TextField {
|
||||||
id: maximumChargeCurrentField
|
id: maximumChargeCurrentField
|
||||||
|
validator: DoubleValidator {}
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
|
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
|
||||||
}
|
}
|
||||||
|
|
||||||
Controls.TextField {
|
Controls.TextField {
|
||||||
id: maximumLoadCurrentField
|
id: maximumLoadCurrentField
|
||||||
|
validator: DoubleValidator {}
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
|
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
|
||||||
}
|
}
|
||||||
@@ -187,6 +193,7 @@ RowLayout {
|
|||||||
|
|
||||||
Controls.TextField {
|
Controls.TextField {
|
||||||
id: maximumTemperatureField
|
id: maximumTemperatureField
|
||||||
|
validator: DoubleValidator {}
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
|
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
|
||||||
Layout.columnSpan: 2
|
Layout.columnSpan: 2
|
||||||
@@ -226,12 +233,14 @@ RowLayout {
|
|||||||
|
|
||||||
Controls.TextField {
|
Controls.TextField {
|
||||||
id: lowerShutdownThresholdField
|
id: lowerShutdownThresholdField
|
||||||
|
validator: DoubleValidator {}
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
|
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
|
||||||
}
|
}
|
||||||
|
|
||||||
Controls.TextField {
|
Controls.TextField {
|
||||||
id: upperShutdownThresholdField
|
id: upperShutdownThresholdField
|
||||||
|
validator: DoubleValidator {}
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
|
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
|
||||||
}
|
}
|
||||||
@@ -299,12 +308,14 @@ RowLayout {
|
|||||||
|
|
||||||
Controls.TextField {
|
Controls.TextField {
|
||||||
id: balancingStartVoltageField
|
id: balancingStartVoltageField
|
||||||
|
validator: DoubleValidator {}
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
|
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
|
||||||
}
|
}
|
||||||
|
|
||||||
Controls.TextField {
|
Controls.TextField {
|
||||||
id: balancingStartDeltaVoltageField
|
id: balancingStartDeltaVoltageField
|
||||||
|
validator: DoubleValidator {}
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
|
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
|
||||||
}
|
}
|
||||||
@@ -509,6 +520,7 @@ RowLayout {
|
|||||||
|
|
||||||
Controls.TextField {
|
Controls.TextField {
|
||||||
id: zeroSensorValueField
|
id: zeroSensorValueField
|
||||||
|
validator: DoubleValidator {}
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
|
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
|
||||||
Layout.columnSpan: 2
|
Layout.columnSpan: 2
|
||||||
@@ -586,11 +598,13 @@ RowLayout {
|
|||||||
Controls.OutlineButton {
|
Controls.OutlineButton {
|
||||||
text: qsTr("Read settings from file")
|
text: qsTr("Read settings from file")
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
onClicked: BmsInterface.commands().getBMSconfDefault()
|
||||||
}
|
}
|
||||||
|
|
||||||
Controls.OutlineButton {
|
Controls.OutlineButton {
|
||||||
text: qsTr("Read current settings from BMS")
|
text: qsTr("Read current settings from BMS")
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
onClicked: BmsInterface.commands().getBMSconf()
|
||||||
}
|
}
|
||||||
|
|
||||||
Controls.OutlineButton {
|
Controls.OutlineButton {
|
||||||
@@ -609,4 +623,44 @@ RowLayout {
|
|||||||
Layout.maximumWidth: 320
|
Layout.maximumWidth: 320
|
||||||
Layout.fillHeight: true
|
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()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user