Various changes have been made as a result of the discussion of the first version
This commit is contained in:
@@ -6,6 +6,8 @@ import Cubo 1.0
|
||||
import Utils 1.0
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
ColumnLayout {
|
||||
spacing: 15
|
||||
anchors.fill: parent
|
||||
@@ -298,6 +300,8 @@ Item {
|
||||
|
||||
Connections {
|
||||
target: BmsInterface.commands()
|
||||
enabled: root.visible
|
||||
|
||||
onValuesReceived: {
|
||||
batteryChargeLevelLabel.text = values.soC
|
||||
batteryVoltageLabel.text = MathHelper.roundDouble(values.packVoltage)
|
||||
@@ -334,7 +338,7 @@ Item {
|
||||
|
||||
Timer {
|
||||
id: refreshValuesTimer
|
||||
interval: 5000
|
||||
interval: 1000
|
||||
onTriggered: getValues()
|
||||
}
|
||||
|
||||
|
||||
@@ -15,13 +15,15 @@ RowLayout {
|
||||
|
||||
signal needWait(bool active, string text)
|
||||
|
||||
spacing: contentColumnSpacing
|
||||
spacing: contentColumnSpacing - 10
|
||||
|
||||
Flickable {
|
||||
id: settingsFlickable
|
||||
clip: true
|
||||
contentWidth: width - rightMargin - leftMargin
|
||||
contentHeight: configLayout.height
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
rightMargin: 10
|
||||
|
||||
ColumnLayout {
|
||||
id: configLayout
|
||||
|
||||
@@ -8,6 +8,8 @@ import Cubo 1.0
|
||||
import Utils 1.0
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
Component {
|
||||
id: cellListHeader
|
||||
|
||||
@@ -22,6 +24,7 @@ Item {
|
||||
Layout.fillWidth: true
|
||||
|
||||
Controls.SubtitleLabel {
|
||||
id: indexTitleLabel
|
||||
text: qsTr("#")
|
||||
color: Palette.tableHeaderTextColor
|
||||
anchors.centerIn: parent
|
||||
@@ -35,6 +38,7 @@ Item {
|
||||
Layout.fillWidth: true
|
||||
|
||||
Controls.SubtitleLabel {
|
||||
id: voltageTitleLabel
|
||||
text: qsTr("Voltage")
|
||||
color: Palette.tableHeaderTextColor
|
||||
anchors.centerIn: parent
|
||||
@@ -48,6 +52,7 @@ Item {
|
||||
Layout.fillWidth: true
|
||||
|
||||
Controls.SubtitleLabel {
|
||||
id: balancingTitleLabel
|
||||
text: qsTr("Balancing")
|
||||
color: Palette.tableHeaderTextColor
|
||||
anchors.centerIn: parent
|
||||
@@ -64,15 +69,16 @@ Item {
|
||||
RowLayout {
|
||||
spacing: 10
|
||||
width: ListView.view.width
|
||||
height: 38
|
||||
height: 36
|
||||
|
||||
Item {
|
||||
Layout.preferredWidth: parent.width / 6 - 20
|
||||
Layout.preferredWidth: parent.width / 6 - 24
|
||||
}
|
||||
|
||||
Controls.SubtitleLabel {
|
||||
id: indexLabel
|
||||
color: Palette.tableHeaderTextColor
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
Layout.preferredWidth: 25
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
}
|
||||
@@ -96,7 +102,7 @@ Item {
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.preferredWidth: parent.width / 6 - 20
|
||||
Layout.preferredWidth: parent.width / 6 - 24
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
@@ -157,12 +163,14 @@ Item {
|
||||
|
||||
Connections {
|
||||
target: BmsInterface.commands()
|
||||
enabled: root.visible
|
||||
|
||||
onCellsReceived: {
|
||||
firstCellGroup.model = []
|
||||
var firstModel = []
|
||||
|
||||
for (var i = 0; i < Math.min(cellCount, 16); ++i) {
|
||||
firstModel.push({"voltage": MathHelper.roundDouble(cellVoltageArray[i]), "balancing": cellVoltageArray[i] < 0})
|
||||
firstModel.push({"voltage": Math.abs(MathHelper.roundDouble(cellVoltageArray[i], 3)), "balancing": cellVoltageArray[i] < 0})
|
||||
}
|
||||
firstCellGroup.model = firstModel
|
||||
|
||||
@@ -171,7 +179,7 @@ Item {
|
||||
var secondModel = []
|
||||
|
||||
for (var j = 16; j < Math.min(cellCount, 32); ++j) {
|
||||
secondModel.push({"voltage": MathHelper.roundDouble(cellVoltageArray[j]), "balancing": cellVoltageArray[i] < 0})
|
||||
secondModel.push({"voltage": Math.abs(MathHelper.roundDouble(cellVoltageArray[j], 3)), "balancing": cellVoltageArray[i] < 0})
|
||||
}
|
||||
secondCellGroup.model = secondModel
|
||||
}
|
||||
@@ -187,7 +195,7 @@ Item {
|
||||
|
||||
Timer {
|
||||
id: refreshValuesTimer
|
||||
interval: 5000
|
||||
interval: 1000
|
||||
onTriggered: getValues()
|
||||
}
|
||||
|
||||
|
||||
@@ -8,9 +8,10 @@ import Cubo 1.0
|
||||
import Utils 1.0
|
||||
|
||||
ColumnLayout {
|
||||
id: root
|
||||
spacing: 20
|
||||
|
||||
property int currentTime: 0
|
||||
property real currentTime: 0
|
||||
|
||||
property var voltageData: []
|
||||
property var currentData: []
|
||||
@@ -86,6 +87,7 @@ ColumnLayout {
|
||||
property Controls.ChartView chartItem: undefined
|
||||
property color seriesColor: "black"
|
||||
property bool horizontal: true
|
||||
property bool selected: false
|
||||
|
||||
Controls.CheckBox {
|
||||
id: checkSeries
|
||||
@@ -114,9 +116,17 @@ ColumnLayout {
|
||||
Rectangle {
|
||||
color: seriesColor
|
||||
radius: width / 2
|
||||
Layout.preferredWidth: 18
|
||||
Layout.preferredHeight: 18
|
||||
border.width: selected ? 2 : 0
|
||||
border.color: "black"
|
||||
Layout.preferredWidth: selected ? 21 : 18
|
||||
Layout.preferredHeight: selected ? 21 : 18
|
||||
Layout.rightMargin: 20
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: if (!selected) selected = true
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
@@ -124,6 +134,10 @@ ColumnLayout {
|
||||
horizontal = !ListView.view
|
||||
seriesColor = chartItem.series(modelData).color
|
||||
checkSeries.text = Qt.binding(function(){ return chartItem.series(modelData).name })
|
||||
|
||||
selectedChanged.connect(function (){ if (selected) chartItem.selectedSeriesIndex = index })
|
||||
chartItem.selectedSeriesIndexChanged.connect(function (){ if (typeof(selected) != "undefined") selected = chartItem.selectedSeriesIndex === index })
|
||||
selected = chartItem.selectedSeriesIndex === index
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -289,44 +303,6 @@ ColumnLayout {
|
||||
RowLayout {
|
||||
spacing: 20
|
||||
|
||||
Controls.Button {
|
||||
text: timer.running ? qsTr("Pause data collection") : qsTr("Resume data collection")
|
||||
onClicked: {
|
||||
if (timer.running)
|
||||
timer.stop()
|
||||
else
|
||||
timer.start()
|
||||
}
|
||||
}
|
||||
|
||||
Controls.Button {
|
||||
text: qsTr("Clear data")
|
||||
onClicked: {
|
||||
currentTime = 0
|
||||
|
||||
clearData(voltageData, voltageLoader)
|
||||
clearData(currentData, currentLoader)
|
||||
clearData(batteryTemperatureData, batteryTemperatureLoader)
|
||||
clearData(bmsTemperatureData, bmsTemperatureLoader)
|
||||
clearData(cellVoltageData, cellVoltageLoader)
|
||||
clearData(cellListData, cellListLoader)
|
||||
|
||||
resetZoomButton.clicked()
|
||||
}
|
||||
|
||||
function clearData(dataObject, chartObject) {
|
||||
for (var i = 0; i < dataObject.length; ++i) {
|
||||
dataObject[i].splice(0, dataObject[i].length)
|
||||
var series = chartObject.item.chart.series(i)
|
||||
series.removePoints(0, series.count)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
Controls.Button {
|
||||
id: resetZoomButton
|
||||
text: qsTr("Reset zoom")
|
||||
@@ -382,6 +358,73 @@ ColumnLayout {
|
||||
return min
|
||||
}
|
||||
}
|
||||
|
||||
Controls.Button {
|
||||
property string pauseText: qsTr("Pause data collection")
|
||||
property string resumeText: qsTr("Resume data collection")
|
||||
text: pauseText
|
||||
onClicked: {
|
||||
if (timer.running) {
|
||||
text = resumeText
|
||||
timer.stop()
|
||||
} else {
|
||||
text = pauseText
|
||||
timer.start()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Controls.Button {
|
||||
text: qsTr("Clear data")
|
||||
onClicked: {
|
||||
currentTime = 0
|
||||
|
||||
clearData(voltageData, voltageLoader)
|
||||
clearData(currentData, currentLoader)
|
||||
clearData(batteryTemperatureData, batteryTemperatureLoader)
|
||||
clearData(bmsTemperatureData, bmsTemperatureLoader)
|
||||
clearData(cellVoltageData, cellVoltageLoader)
|
||||
clearData(cellListData, cellListLoader)
|
||||
|
||||
resetZoomButton.clicked()
|
||||
}
|
||||
|
||||
function clearData(dataObject, chartObject) {
|
||||
for (var i = 0; i < dataObject.length; ++i) {
|
||||
dataObject[i].splice(0, dataObject[i].length)
|
||||
var series = chartObject.item.chart.series(i)
|
||||
series.removePoints(0, series.count)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
spacing: 10
|
||||
|
||||
Controls.SubtitleLabel {
|
||||
text: qsTr("Interval, s")
|
||||
}
|
||||
|
||||
Controls.TextField {
|
||||
id: intervalField
|
||||
validator: DoubleValidator { bottom: 0.1; top: 100; decimals: 1; locale: "en-US" }
|
||||
text: "1"
|
||||
onEditingFinished: timer.interval = parseFloat(text) * 1000
|
||||
Layout.preferredHeight: 44
|
||||
}
|
||||
|
||||
Controls.ImageButton {
|
||||
icon.source: "qrc:/Icons/check-indicator.svg"
|
||||
icon.width: 32
|
||||
icon.height: 32
|
||||
Layout.preferredWidth: 42
|
||||
Layout.preferredHeight: 42
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
@@ -395,6 +438,7 @@ ColumnLayout {
|
||||
|
||||
Connections {
|
||||
target: BmsInterface.commands()
|
||||
enabled: root.visible
|
||||
|
||||
onValuesReceived: {
|
||||
addValueToChart(values.packVoltage, voltageData, voltageLoader, 0, 0.05)
|
||||
@@ -428,7 +472,7 @@ ColumnLayout {
|
||||
addValueToChart(cellVoltageArray[j], cellListData, cellListLoader, j, 0.05)
|
||||
}
|
||||
|
||||
currentTime += 1
|
||||
currentTime = Math.round((timer.interval / 1000 + currentTime + Number.EPSILON) * 10) / 10
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user