aboutsummaryrefslogtreecommitdiffstats
path: root/jetting-interface/CommandsPage.qml
blob: 5a084e6e472a65c52bc874475ec8e78b36e7e5c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
pragma ComponentBehavior: Bound

import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import Xpl2

ColumnLayout {
    id: commandsPage

    required property int demoPhCount
    required property ListModel phModel

    spacing: 12

    // --- JC Version ---
    GroupBox {
        Layout.fillWidth: true
        enabled: Xpl2Client.connected
        title: "Jetting Controller"

        RowLayout {
            anchors.fill: parent

            Button {
                text: "Get JC Version"

                onClicked: Xpl2Client.getJcVersion()
            }

            Label {
                text: Xpl2Client.controllerId > 0
                      ? "Controller: %1 | FW: %2 | HW: %3 | PHs: %4".arg(
                            Xpl2Client.controllerId).arg(
                            Xpl2Client.firmwareVersion).arg(
                            Xpl2Client.hardwareVersion).arg(
                            Xpl2Client.printheadCount) : "No version data"
            }
        }
    }

    // --- Control ---
    GroupBox {
        Layout.fillWidth: true
        enabled: Xpl2Client.connected
        title: "Control"

        GridLayout {
            anchors.fill: parent
            columns: 4

            Button {
                text: "Jetting All On"

                onClicked: Xpl2Client.jettingAllOn()
            }

            Button {
                text: "Jetting Off"

                onClicked: Xpl2Client.jettingOff()
            }

            Button {
                text: "JC LED On"

                onClicked: Xpl2Client.jcIdLedOn()
            }

            Button {
                text: "JC LED Off"

                onClicked: Xpl2Client.jcIdLedOff()
            }

            Button {
                text: "JC Calibration"

                onClicked: Xpl2Client.jcCalibration()
            }

            Button {
                text: "Reset Fault Codes"

                onClicked: Xpl2Client.jcResetFaultCodes()
            }
        }
    }

    // --- Configuration ---
    GroupBox {
        Layout.fillWidth: true
        enabled: Xpl2Client.connected
        title: "Configuration"

        GridLayout {
            anchors.fill: parent
            columns: 4

            Button {
                text: "Save All Settings"

                onClicked: Xpl2Client.jcSaveAllPrintheadSettings()
            }

            Button {
                text: "Reboot All PHs"

                onClicked: Xpl2Client.jcRebootAllPrintheads()
            }

            Button {
                text: "Restart JC"

                onClicked: Xpl2Client.jcRestart()
            }

            Button {
                text: "Shutdown JC"

                onClicked: Xpl2Client.jcShutdown()
            }
        }
    }

    // --- Imaging ---
    GroupBox {
        Layout.fillWidth: true
        enabled: Xpl2Client.connected
        title: "Imaging"

        GridLayout {
            anchors.fill: parent
            columns: 4

            Button {
                text: "Start Imaging"

                onClicked: Xpl2Client.imagingStart(1.0)
            }

            Button {
                text: "Stop Imaging"

                onClicked: Xpl2Client.imagingStop()
            }

            Button {
                text: "Image Count"

                onClicked: Xpl2Client.imageCount()
            }
        }
    }

    // --- Printheads ---
    GroupBox {
        Layout.fillHeight: true
        Layout.fillWidth: true
        enabled: Xpl2Client.connected
        title: "Printheads (%1)".arg(commandsPage.demoPhCount)

        ColumnLayout {
            anchors.fill: parent

            Button {
                text: "Get All PH Versions"

                onClicked: {
                    for (let i = 0; i < commandsPage.phModel.count; ++i)
                    Xpl2Client.getPhVersion(commandsPage.phModel.get(i).phId);
                }
            }

            ScrollView {
                Layout.fillHeight: true
                Layout.fillWidth: true

                ListView {
                    model: commandsPage.phModel
                    spacing: 4

                    delegate: RowLayout {
                        id: phDelegate

                        required property int phId
                        required property string versionInfo

                        width: ListView.view.width

                        Label {
                            Layout.preferredWidth: 50
                            font.bold: true
                            text: "PH %1".arg(phDelegate.phId)
                        }

                        Button {
                            text: "Version"

                            onClicked: Xpl2Client.getPhVersion(phDelegate.phId)
                        }

                        Label {
                            Layout.fillWidth: true
                            elide: Text.ElideRight
                            text: phDelegate.versionInfo || "—"
                        }
                    }
                }
            }
        }
    }
}