Implemented first version of Chm30Utility

This commit is contained in:
Yury Shuvakin
2025-03-17 19:12:22 +09:00
commit 6be3459a37
83 changed files with 10515 additions and 0 deletions

261
main.qml Normal file
View File

@@ -0,0 +1,261 @@
import QtQuick 2.12
import QtQuick.Window 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
import Core 1.0
ApplicationWindow {
width: 1100
height: 640
visible: true
title: qsTr("Charge module 30KW utility")
font.pixelSize: 14
GridLayout {
anchors.fill: parent
anchors.margins: 10
columns: 2
columnSpacing: 10
rowSpacing: 10
GroupBox {
title: qsTr("Parameters")
GridLayout {
anchors.fill: parent
columns: 2
rowSpacing: 20
columnSpacing: 10
Label {
text: qsTr("Current module")
}
ComboBox {
model: {
let model = []
for (let i = 0; i < CanController.numberOfModules; i++) {
model.push(i + 1)
}
if (model.length > 1) {
model.push(qsTr("All"))
}
return model
}
onCurrentIndexChanged: {
if (currentIndex === model.length - 1 && model.length > 1) {
CanController.currentModule = 0x3F
} else {
CanController.currentModule = currentIndex
}
}
}
Label {
text: qsTr("Connection with module")
}
Label {
text: CanController.isConnected ? qsTr("Yes") : qsTr("No")
}
Label {
text: qsTr("Serial number")
}
Label {
text: CanController.serialNumber
}
Label {
text: qsTr("Сharacteristics")
}
Label {
text: CanController.characteristics
}
Label {
text: qsTr("Mode")
}
Label {
text: CanController.mode
}
Label {
text: qsTr("Module limitations")
}
Label {
text: CanController.limitations
}
Label {
text: qsTr("Input voltage, V")
}
Label {
text: CanController.inputVoltage
}
Label {
text: qsTr("Output current, A")
}
Label {
text: CanController.outputCurrent
}
Label {
text: qsTr("Output voltage, V")
}
Label {
text: CanController.outputVoltage
}
Label {
text: qsTr("Module temperature, °C")
}
Label {
text: CanController.moduleTemperature
}
Item {
Layout.fillHeight: true
Layout.columnSpan: 2
}
}
Layout.rowSpan: 2
Layout.fillWidth: true
Layout.fillHeight: true
implicitWidth: 2
}
GroupBox {
title: qsTr("Settings")
GridLayout {
anchors.fill: parent
columns: 2
rowSpacing: 16
columnSpacing: 10
Label {
text: qsTr("Turn on the module")
}
Switch {
checked: CanController.isModuleOnOff
onToggled: {
CanController.isModuleOnOff = checked
CanController.setModuleOnOff(checked)
}
}
Label {
text: qsTr("Turn on the LED")
}
Switch {
checked: CanController.isLedOnOff
onToggled: {
CanController.isLedOnOff = checked
CanController.setLedOnOff(checked)
}
}
Label {
text: qsTr("Low/High mode")
}
Switch {
checked: CanController.highLowMode
onToggled: {
CanController.highLowMode = checked
CanController.setHighLowMode(checked)
}
}
Label {
text: qsTr("Setting the output voltage, V")
}
TextField {
text: qsTr("0")
selectByMouse: true
validator: DoubleValidator { bottom: 0.0; top: 1000.0; decimals: 3; notation: DoubleValidator.StandardNotation }
onEditingFinished: {
CanController.setupOutputVoltage = parseFloat(text)
}
}
Label {
text: qsTr("Setting the output current, A")
}
TextField {
text: qsTr("0")
selectByMouse: true
validator: DoubleValidator { bottom: 0.0; top: 100.0; decimals: 3; notation: DoubleValidator.StandardNotation }
onEditingFinished: {
CanController.setupOutputCurrent = parseFloat(text)
}
}
Button {
text: qsTr("Set output voltage and current")
onClicked: CanController.setOutputParameters()
Layout.alignment: Qt.AlignCenter
Layout.columnSpan: 2
}
}
Layout.fillWidth: true
implicitWidth: 3
}
GroupBox {
title: qsTr("Log")
ListView {
id: statusView
clip: true
anchors.fill: parent
boundsBehavior: Flickable.StopAtBounds
flickableDirection: Flickable.HorizontalAndVerticalFlick
model: CanController.statuses
delegate: ItemDelegate {
text: modelData.time + " " + modelData.status + " " + modelData.description
font.pixelSize: 12
onWidthChanged: {
if (width > statusView.contentWidth) {
statusView.contentWidth = width
}
}
}
ScrollBar.vertical: ScrollBar {}
ScrollBar.horizontal: ScrollBar {}
}
Layout.fillWidth: true
Layout.fillHeight: true
implicitWidth: 3
}
}
}