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.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
ColumnLayout {
width: 50
height: 200
delegate: Pane {
property int deviceAddress: model.address
property int myDeviceTypeId: model.deviceTypeId
Label {
Layout.fillWidth: true
text: index
horizontalAlignment: Text.AlignHCenter
}
Material.elevation: 6
Slider {
id: slider
Layout.fillWidth: true
Layout.fillHeight: true
//width: 75
height: 250
orientation: Qt.Vertical
from: 0
to: 255
ColumnLayout {
anchors.fill: parent
onValueChanged: __controller.setChannel(32 + index, value)
}
Label {
Layout.fillWidth: true
text: model.name
horizontalAlignment: Text.AlignHCenter
}
Label {
Layout.fillWidth: true
text: Math.round(slider.value)
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
}
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)
{
//qDebug() << channel << value;
Q_ASSERT(channel >= 0 && channel < std::size(buf));
buf[channel] = value;
}