|
@@ -61,6 +61,7 @@ enum ui_pages {
|
61
|
61
|
UI_START = 0,
|
62
|
62
|
UI_LIVINGROOM1,
|
63
|
63
|
UI_LIVINGROOM2,
|
|
64
|
+ UI_BATHROOM,
|
64
|
65
|
|
65
|
66
|
UI_NUM_PAGES
|
66
|
67
|
};
|
|
@@ -143,6 +144,32 @@ static void draw_livingroom2(void) {
|
143
|
144
|
ui_status.light_box ? TFT_GREEN : TFT_RED);
|
144
|
145
|
}
|
145
|
146
|
|
|
147
|
+static void draw_bathroom(void) {
|
|
148
|
+ // 1
|
|
149
|
+ draw_button("Bath Lights Auto",
|
|
150
|
+ BTNS_OFF_X + BTN_W / 2,
|
|
151
|
+ BTNS_OFF_Y + BTN_H / 2,
|
|
152
|
+ ui_status.bathroom_lights == BATH_LIGHT_NONE ? TFT_GREEN : TFT_RED);
|
|
153
|
+
|
|
154
|
+ // 2
|
|
155
|
+ draw_button("Bath Lights Big",
|
|
156
|
+ BTNS_OFF_X + BTN_W / 2,
|
|
157
|
+ BTNS_OFF_Y + BTN_H / 2 + BTN_H + BTN_GAP,
|
|
158
|
+ ui_status.bathroom_lights == BATH_LIGHT_BIG ? TFT_GREEN : TFT_RED);
|
|
159
|
+
|
|
160
|
+ // 4
|
|
161
|
+ draw_button("Bath Lights Off",
|
|
162
|
+ BTNS_OFF_X + BTN_W / 2 + BTN_W + BTN_GAP,
|
|
163
|
+ BTNS_OFF_Y + BTN_H / 2,
|
|
164
|
+ ui_status.bathroom_lights == BATH_LIGHT_OFF ? TFT_GREEN : TFT_RED);
|
|
165
|
+
|
|
166
|
+ // 5
|
|
167
|
+ draw_button("Bath Lights Small",
|
|
168
|
+ BTNS_OFF_X + BTN_W / 2 + BTN_W + BTN_GAP,
|
|
169
|
+ BTNS_OFF_Y + BTN_H / 2 + BTN_H + BTN_GAP,
|
|
170
|
+ ui_status.bathroom_lights == BATH_LIGHT_SMALL ? TFT_GREEN : TFT_RED);
|
|
171
|
+}
|
|
172
|
+
|
146
|
173
|
void ui_init(void) {
|
147
|
174
|
mySpi.begin(XPT2046_CLK, XPT2046_MISO, XPT2046_MOSI, XPT2046_CS);
|
148
|
175
|
ts.begin(mySpi);
|
|
@@ -173,6 +200,10 @@ static void ui_draw_menu(void) {
|
173
|
200
|
draw_livingroom2();
|
174
|
201
|
break;
|
175
|
202
|
|
|
203
|
+ case UI_BATHROOM:
|
|
204
|
+ draw_bathroom();
|
|
205
|
+ break;
|
|
206
|
+
|
176
|
207
|
default:
|
177
|
208
|
ui_page = UI_START;
|
178
|
209
|
ui_draw_menu();
|
|
@@ -237,6 +268,8 @@ void ui_run(void) {
|
237
|
268
|
INVERT_BOOL(ui_status.light_corner);
|
238
|
269
|
} else if (ui_page == UI_LIVINGROOM2) {
|
239
|
270
|
INVERT_BOOL(ui_status.light_pc);
|
|
271
|
+ } else if (ui_page == UI_BATHROOM) {
|
|
272
|
+ ui_status.bathroom_lights = BATH_LIGHT_NONE;
|
240
|
273
|
}
|
241
|
274
|
writeMQTT_UI();
|
242
|
275
|
} else if ((p.x >= BTNS_OFF_X) && (p.x <= BTNS_OFF_X + BTN_W) && (p.y >= (BTNS_OFF_Y + BTN_H + BTN_GAP)) && (p.y <= (BTNS_OFF_Y + BTN_H + BTN_GAP + BTN_H))) {
|
|
@@ -245,6 +278,8 @@ void ui_run(void) {
|
245
|
278
|
INVERT_BOOL(ui_status.light_workspace);
|
246
|
279
|
} else if (ui_page == UI_LIVINGROOM2) {
|
247
|
280
|
INVERT_BOOL(ui_status.light_bench);
|
|
281
|
+ } else if (ui_page == UI_BATHROOM) {
|
|
282
|
+ ui_status.bathroom_lights = BATH_LIGHT_BIG;
|
248
|
283
|
}
|
249
|
284
|
writeMQTT_UI();
|
250
|
285
|
} else if ((p.x >= BTNS_OFF_X) && (p.x <= BTNS_OFF_X + BTN_W) && (p.y >= (BTNS_OFF_Y + BTN_H * 2 + BTN_GAP * 2)) && (p.y <= (BTNS_OFF_Y + BTN_H * 2 + BTN_GAP * 2 + BTN_H))) {
|
|
@@ -259,6 +294,8 @@ void ui_run(void) {
|
259
|
294
|
INVERT_BOOL(ui_status.sound_amplifier);
|
260
|
295
|
} else if (ui_page == UI_LIVINGROOM2) {
|
261
|
296
|
INVERT_BOOL(ui_status.light_amp);
|
|
297
|
+ } else if (ui_page == UI_BATHROOM) {
|
|
298
|
+ ui_status.bathroom_lights = BATH_LIGHT_OFF;
|
262
|
299
|
}
|
263
|
300
|
writeMQTT_UI();
|
264
|
301
|
} else if ((p.x >= BTNS_OFF_X + BTN_W + BTN_GAP) && (p.x <= BTNS_OFF_X + BTN_W + BTN_GAP + BTN_W) && (p.y >= (BTNS_OFF_Y + BTN_H + BTN_GAP)) && (p.y <= (BTNS_OFF_Y + BTN_H + BTN_GAP + BTN_H))) {
|
|
@@ -273,6 +310,8 @@ void ui_run(void) {
|
273
|
310
|
ui_status.light_box = false;
|
274
|
311
|
} else if (ui_page == UI_LIVINGROOM2) {
|
275
|
312
|
INVERT_BOOL(ui_status.light_box);
|
|
313
|
+ } else if (ui_page == UI_BATHROOM) {
|
|
314
|
+ ui_status.bathroom_lights = BATH_LIGHT_SMALL;
|
276
|
315
|
}
|
277
|
316
|
writeMQTT_UI();
|
278
|
317
|
} else if ((p.x >= BTNS_OFF_X + BTN_W + BTN_GAP) && (p.x <= BTNS_OFF_X + BTN_W + BTN_GAP + BTN_W) && (p.y >= (BTNS_OFF_Y + BTN_H * 2 + BTN_GAP * 2)) && (p.y <= (BTNS_OFF_Y + BTN_H * 2 + BTN_GAP * 2 + BTN_H))) {
|