HomeScreen improvements with registers for each lamp

This commit is contained in:
2023-02-15 23:14:22 +01:00
parent 09d88ea75e
commit 0be230668d
2 changed files with 61 additions and 22 deletions

View File

@@ -2,24 +2,57 @@ import QtQuick
import QtQuick.Controls.Material import QtQuick.Controls.Material
import QtQuick.Layouts import QtQuick.Layouts
import com.büro 1.0
RowLayout { RowLayout {
Item { Item {
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
Flow { Flow {
anchors.centerIn: parent anchors.fill: parent
spacing: 5
Repeater { Repeater {
model: devicesModel model: devicesModel
delegate: Pane {
property int deviceAddress: model.address
property int myDeviceTypeId: model.deviceTypeId
Material.elevation: 6
//width: 75
height: 250
ColumnLayout { ColumnLayout {
width: 50 anchors.fill: parent
height: 200
Label { Label {
Layout.fillWidth: true Layout.fillWidth: true
text: index text: model.name
horizontalAlignment: Text.AlignHCenter
}
RowLayout {
Layout.fillWidth: true
Layout.fillHeight: true
Repeater {
model: DeviceTypeRegistersModel {
controller: __controller
deviceTypeId: myDeviceTypeId
}
delegate: ColumnLayout {
property int registerAddress: deviceAddress + index
Layout.fillHeight: true
Label {
Layout.fillWidth: true
text: model.registerTypeName
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
} }
@@ -32,7 +65,7 @@ RowLayout {
from: 0 from: 0
to: 255 to: 255
onValueChanged: __controller.setChannel(32 + index, value) onValueChanged: __controller.setChannel(registerAddress, value)
} }
Label { Label {
@@ -44,6 +77,10 @@ RowLayout {
} }
} }
} }
}
}
}
}
ColumnLayout { ColumnLayout {
Layout.preferredWidth: 100 Layout.preferredWidth: 100

View File

@@ -103,6 +103,8 @@ bool DmxController::start()
void DmxController::setChannel(int channel, int value) void DmxController::setChannel(int channel, int value)
{ {
//qDebug() << channel << value;
Q_ASSERT(channel >= 0 && channel < std::size(buf));
buf[channel] = value; buf[channel] = value;
} }