Added board firmware update functionality

This commit is contained in:
Yury Shuvakin
2022-09-13 15:20:09 +03:00
parent d28efef208
commit 4dd1f95193
21 changed files with 908 additions and 225 deletions

View File

@@ -1,74 +1,46 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
import Controls 1.0 as Controls
import Cubo 1.0
import Screens 1.0 as Screens
ColumnLayout {
RowLayout {
spacing: 20
Keys.onReturnPressed: sendButton.clicked()
Keys.onEnterPressed: sendButton.clicked()
property string title: stack.itemAt(stack.currentIndex).title
Controls.Frame {
Flickable {
id: outputFlickable
clip: true
anchors.fill: parent
boundsBehavior: Flickable.StopAtBounds
StackLayout {
id: stack
TextArea.flickable: Controls.TextArea {
id: outputArea
}
Screens.TerminalScreen {
id: terminalScreen
property string title: qsTr("Terminal")
}
ScrollBar.horizontal: Controls.ScrollBar {}
ScrollBar.vertical: Controls.ScrollBar {}
Screens.FirmwareUpdateScreen {
id: firmwareUpdateScreen
property string title: qsTr("Firmware update")
}
Layout.fillWidth: true
Layout.fillHeight: true
}
RowLayout {
ColumnLayout {
spacing: 20
Controls.Button {
text: qsTr("Clear")
Layout.preferredWidth: 120
onClicked: outputArea.clear()
}
Controls.TextField {
id: commandField
implicitHeight: 52
Layout.fillWidth: true
}
Controls.Button {
id: sendButton
text: qsTr("Send")
Layout.preferredWidth: 120
onClicked: {
BmsInterface.commands().sendTerminalCmd(commandField.text)
commandField.clear()
Repeater {
model: [terminalScreen.title, firmwareUpdateScreen.title]
delegate: Controls.LinkLabel {
text: modelData
onClicked: stack.currentIndex = index
}
}
Controls.Button {
text: qsTr("Help")
Layout.preferredWidth: 120
onClicked: BmsInterface.commands().sendTerminalCmd("help")
Item {
Layout.fillHeight: true
}
Layout.fillWidth: true
}
Connections {
target: BmsInterface.commands()
onPrintReceived: {
outputArea.append(str)
outputArea.cursorPosition = outputArea.length
}
Layout.preferredWidth: 180
}
}