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.Layouts
import com.büro 1.0
RowLayout {
Item {
Layout.fillWidth: true
Layout.fillHeight: true
Flow {
anchors.centerIn: parent
anchors.fill: parent
spacing: 5
Repeater {
model: devicesModel
delegate: Pane {
property int deviceAddress: model.address
property int myDeviceTypeId: model.deviceTypeId
Material.elevation: 6
//width: 75
height: 250
ColumnLayout {
width: 50
height: 200
anchors.fill: parent
Label {
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
}
@@ -32,7 +65,7 @@ RowLayout {
from: 0
to: 255
onValueChanged: __controller.setChannel(32 + index, value)
onValueChanged: __controller.setChannel(registerAddress, value)
}
Label {
@@ -44,6 +77,10 @@ RowLayout {
}
}
}
}
}
}
}
ColumnLayout {
Layout.preferredWidth: 100

View File

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