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,43 +2,80 @@ 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
ColumnLayout { delegate: Pane {
width: 50 property int deviceAddress: model.address
height: 200 property int myDeviceTypeId: model.deviceTypeId
Label { Material.elevation: 6
Layout.fillWidth: true
text: index
horizontalAlignment: Text.AlignHCenter
}
Slider { //width: 75
id: slider height: 250
Layout.fillWidth: true
Layout.fillHeight: true
orientation: Qt.Vertical ColumnLayout {
from: 0 anchors.fill: parent
to: 255
onValueChanged: __controller.setChannel(32 + index, value) Label {
} Layout.fillWidth: true
text: model.name
horizontalAlignment: Text.AlignHCenter
}
Label { RowLayout {
Layout.fillWidth: true Layout.fillWidth: true
text: Math.round(slider.value) Layout.fillHeight: true
horizontalAlignment: Text.AlignHCenter
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
}
Slider {
id: slider
Layout.fillWidth: true
Layout.fillHeight: true
orientation: Qt.Vertical
from: 0
to: 255
onValueChanged: __controller.setChannel(registerAddress, value)
}
Label {
Layout.fillWidth: true
text: Math.round(slider.value)
horizontalAlignment: Text.AlignHCenter
}
}
}
}
} }
} }
} }

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;
} }