|
@@ -42,32 +42,36 @@
|
42
|
42
|
|
43
|
43
|
#include <stdio.h>
|
44
|
44
|
|
|
45
|
+#define ICON_POS_Y 38
|
|
46
|
+#define TARGET_LABEL_MOD_Y -36
|
|
47
|
+#define LABEL_MOD_Y 30
|
|
48
|
+#define SECOND_EXT_MOD_Y 100
|
|
49
|
+
|
45
|
50
|
extern lv_group_t* g;
|
46
|
51
|
static lv_obj_t *scr;
|
|
52
|
+static lv_obj_t *labelExt1, *labelExt1Target, *labelFan;
|
|
53
|
+
|
|
54
|
+#if HAS_MULTI_EXTRUDER
|
|
55
|
+ static lv_obj_t *labelExt2, *labelExt2Target;
|
|
56
|
+#endif
|
|
57
|
+
|
|
58
|
+#if HAS_HEATED_BED
|
|
59
|
+ static lv_obj_t *labelBed, *labelBedTarget;
|
|
60
|
+#endif
|
|
61
|
+
|
47
|
62
|
#if ENABLED(MKS_TEST)
|
48
|
63
|
uint8_t curent_disp_ui = 0;
|
49
|
64
|
#endif
|
50
|
65
|
|
51
|
|
-enum {
|
52
|
|
- ID_TOOL = 1,
|
53
|
|
- ID_SET,
|
54
|
|
- ID_PRINT
|
55
|
|
-};
|
|
66
|
+enum { ID_TOOL = 1, ID_SET, ID_PRINT };
|
56
|
67
|
|
57
|
68
|
static void event_handler(lv_obj_t *obj, lv_event_t event) {
|
58
|
69
|
if (event != LV_EVENT_RELEASED) return;
|
59
|
70
|
lv_clear_ready_print();
|
60
|
|
-
|
61
|
71
|
switch (obj->mks_obj_id) {
|
62
|
|
- case ID_TOOL:
|
63
|
|
- lv_draw_tool();
|
64
|
|
- break;
|
65
|
|
- case ID_SET:
|
66
|
|
- lv_draw_set();
|
67
|
|
- break;
|
68
|
|
- case ID_PRINT:
|
69
|
|
- lv_draw_print_file();
|
70
|
|
- break;
|
|
72
|
+ case ID_TOOL: lv_draw_tool(); break;
|
|
73
|
+ case ID_SET: lv_draw_set(); break;
|
|
74
|
+ case ID_PRINT: lv_draw_print_file(); break;
|
71
|
75
|
}
|
72
|
76
|
}
|
73
|
77
|
|
|
@@ -98,14 +102,14 @@ void disp_det_error() {
|
98
|
102
|
lv_obj_t *e1, *e2, *e3, *bed;
|
99
|
103
|
void mks_disp_test() {
|
100
|
104
|
char buf[30] = {0};
|
101
|
|
- sprintf_P(buf, PSTR("e1:%d"), (int)thermalManager.degHotend(0));
|
|
105
|
+ sprintf_P(buf, PSTR("e1:%d"), thermalManager.degHotend(0));
|
102
|
106
|
lv_label_set_text(e1, buf);
|
103
|
107
|
#if HAS_MULTI_HOTEND
|
104
|
|
- sprintf_P(buf, PSTR("e2:%d"), (int)thermalManager.degHotend(1));
|
|
108
|
+ sprintf_P(buf, PSTR("e2:%d"), thermalManager.degHotend(1));
|
105
|
109
|
lv_label_set_text(e2, buf);
|
106
|
110
|
#endif
|
107
|
111
|
#if HAS_HEATED_BED
|
108
|
|
- sprintf_P(buf, PSTR("bed:%d"), (int)thermalManager.temp_bed.celsius);
|
|
112
|
+ sprintf_P(buf, PSTR("bed:%d"), thermalManager.degBed());
|
109
|
113
|
lv_label_set_text(bed, buf);
|
110
|
114
|
#endif
|
111
|
115
|
}
|
|
@@ -130,53 +134,123 @@ void lv_draw_ready_print() {
|
130
|
134
|
lv_obj_align(label_tool, buttonTool, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
|
131
|
135
|
}
|
132
|
136
|
|
133
|
|
- #if 1
|
134
|
|
- e1 = lv_label_create_empty(scr);
|
135
|
|
- lv_obj_set_pos(e1, 20, 20);
|
136
|
|
- sprintf_P(buf, PSTR("e1: %d"), (int)thermalManager.degHotend(0));
|
137
|
|
- lv_label_set_text(e1, buf);
|
138
|
|
- #if HAS_MULTI_HOTEND
|
139
|
|
- e2 = lv_label_create_empty(scr);
|
140
|
|
- lv_obj_set_pos(e2, 20, 45);
|
141
|
|
- sprintf_P(buf, PSTR("e1: %d"), (int)thermalManager.degHotend(1));
|
142
|
|
- lv_label_set_text(e2, buf);
|
143
|
|
- #endif
|
144
|
|
-
|
145
|
|
- #if HAS_HEATED_BED
|
146
|
|
- bed = lv_label_create_empty(scr);
|
147
|
|
- lv_obj_set_pos(bed, 20, 95);
|
148
|
|
- sprintf_P(buf, PSTR("bed: %d"), (int)thermalManager.temp_bed.celsius);
|
149
|
|
- lv_label_set_text(bed, buf);
|
150
|
|
- #endif
|
151
|
|
-
|
152
|
|
- limit_info = lv_label_create_empty(scr);
|
153
|
|
-
|
154
|
|
- lv_style_copy(&limit_style, &lv_style_scr);
|
155
|
|
- limit_style.body.main_color.full = 0x0000;
|
156
|
|
- limit_style.body.grad_color.full = 0x0000;
|
157
|
|
- limit_style.text.color.full = 0xffff;
|
158
|
|
- lv_obj_set_style(limit_info, &limit_style);
|
159
|
|
-
|
160
|
|
- lv_obj_set_pos(limit_info, 20, 120);
|
161
|
|
- lv_label_set_text(limit_info, " ");
|
162
|
|
-
|
163
|
|
- det_info = lv_label_create_empty(scr);
|
164
|
|
-
|
165
|
|
- lv_style_copy(&det_style, &lv_style_scr);
|
166
|
|
- det_style.body.main_color.full = 0x0000;
|
167
|
|
- det_style.body.grad_color.full = 0x0000;
|
168
|
|
- det_style.text.color.full = 0xffff;
|
169
|
|
- lv_obj_set_style(det_info, &det_style);
|
170
|
|
-
|
171
|
|
- lv_obj_set_pos(det_info, 20, 145);
|
172
|
|
- lv_label_set_text(det_info, " ");
|
173
|
|
- #endif // if 1
|
|
137
|
+ e1 = lv_label_create_empty(scr);
|
|
138
|
+ lv_obj_set_pos(e1, 20, 20);
|
|
139
|
+ sprintf_P(buf, PSTR("e1: %d"), thermalManager.degHotend(0));
|
|
140
|
+ lv_label_set_text(e1, buf);
|
|
141
|
+
|
|
142
|
+ #if HAS_MULTI_HOTEND
|
|
143
|
+ e2 = lv_label_create_empty(scr);
|
|
144
|
+ lv_obj_set_pos(e2, 20, 45);
|
|
145
|
+ sprintf_P(buf, PSTR("e1: %d"), thermalManager.degHotend(1));
|
|
146
|
+ lv_label_set_text(e2, buf);
|
|
147
|
+ #endif
|
|
148
|
+
|
|
149
|
+ #if HAS_HEATED_BED
|
|
150
|
+ bed = lv_label_create_empty(scr);
|
|
151
|
+ lv_obj_set_pos(bed, 20, 95);
|
|
152
|
+ sprintf_P(buf, PSTR("bed: %d"), thermalManager.degBed());
|
|
153
|
+ lv_label_set_text(bed, buf);
|
|
154
|
+ #endif
|
|
155
|
+
|
|
156
|
+ limit_info = lv_label_create_empty(scr);
|
|
157
|
+
|
|
158
|
+ lv_style_copy(&limit_style, &lv_style_scr);
|
|
159
|
+ limit_style.body.main_color.full = 0x0000;
|
|
160
|
+ limit_style.body.grad_color.full = 0x0000;
|
|
161
|
+ limit_style.text.color.full = 0xFFFF;
|
|
162
|
+ lv_obj_set_style(limit_info, &limit_style);
|
|
163
|
+
|
|
164
|
+ lv_obj_set_pos(limit_info, 20, 120);
|
|
165
|
+ lv_label_set_text(limit_info, " ");
|
|
166
|
+
|
|
167
|
+ det_info = lv_label_create_empty(scr);
|
174
|
168
|
|
|
169
|
+ lv_style_copy(&det_style, &lv_style_scr);
|
|
170
|
+ det_style.body.main_color.full = 0x0000;
|
|
171
|
+ det_style.body.grad_color.full = 0x0000;
|
|
172
|
+ det_style.text.color.full = 0xFFFF;
|
|
173
|
+ lv_obj_set_style(det_info, &det_style);
|
|
174
|
+
|
|
175
|
+ lv_obj_set_pos(det_info, 20, 145);
|
|
176
|
+ lv_label_set_text(det_info, " ");
|
175
|
177
|
}
|
176
|
178
|
else {
|
177
|
|
- lv_big_button_create(scr, "F:/bmp_tool.bin", main_menu.tool, 20, 90, event_handler, ID_TOOL);
|
178
|
|
- lv_big_button_create(scr, "F:/bmp_set.bin", main_menu.set, 180, 90, event_handler, ID_SET);
|
179
|
|
- lv_big_button_create(scr, "F:/bmp_printing.bin", main_menu.print, 340, 90, event_handler, ID_PRINT);
|
|
179
|
+ lv_big_button_create(scr, "F:/bmp_tool.bin", main_menu.tool, 20, 180, event_handler, ID_TOOL);
|
|
180
|
+ lv_big_button_create(scr, "F:/bmp_set.bin", main_menu.set, 180, 180, event_handler, ID_SET);
|
|
181
|
+ lv_big_button_create(scr, "F:/bmp_printing.bin", main_menu.print, 340, 180, event_handler, ID_PRINT);
|
|
182
|
+
|
|
183
|
+ // Monitoring
|
|
184
|
+ lv_obj_t *buttonExt1 = lv_img_create(scr, NULL);
|
|
185
|
+ #if HAS_MULTI_EXTRUDER
|
|
186
|
+ lv_obj_t *buttonExt2 = lv_img_create(scr, NULL);
|
|
187
|
+ #endif
|
|
188
|
+ #if HAS_HEATED_BED
|
|
189
|
+ lv_obj_t *buttonBedstate = lv_img_create(scr, NULL);
|
|
190
|
+ #endif
|
|
191
|
+ lv_obj_t *buttonFanstate = lv_img_create(scr, NULL);
|
|
192
|
+
|
|
193
|
+ lv_img_set_src(buttonExt1, "F:/bmp_ext1_state.bin");
|
|
194
|
+ #if HAS_MULTI_EXTRUDER
|
|
195
|
+ lv_img_set_src(buttonExt2, "F:/bmp_ext2_state.bin");
|
|
196
|
+ #endif
|
|
197
|
+ #if HAS_HEATED_BED
|
|
198
|
+ lv_img_set_src(buttonBedstate, "F:/bmp_bed_state.bin");
|
|
199
|
+ #endif
|
|
200
|
+ lv_img_set_src(buttonFanstate, "F:/bmp_fan_state.bin");
|
|
201
|
+
|
|
202
|
+ lv_obj_set_pos(buttonExt1, 55, ICON_POS_Y);
|
|
203
|
+ #if HAS_MULTI_EXTRUDER
|
|
204
|
+ lv_obj_set_pos(buttonExt2, 55, ICON_POS_Y + SECOND_EXT_MOD_Y);
|
|
205
|
+ #endif
|
|
206
|
+ #if HAS_HEATED_BED
|
|
207
|
+ lv_obj_set_pos(buttonBedstate, 210, ICON_POS_Y);
|
|
208
|
+ #endif
|
|
209
|
+ lv_obj_set_pos(buttonFanstate, 380, ICON_POS_Y);
|
|
210
|
+
|
|
211
|
+ labelExt1 = lv_label_create(scr, 55, LABEL_MOD_Y, nullptr);
|
|
212
|
+ labelExt1Target = lv_label_create(scr, 55, LABEL_MOD_Y, nullptr);
|
|
213
|
+
|
|
214
|
+ #if HAS_MULTI_EXTRUDER
|
|
215
|
+ labelExt2 = lv_label_create(scr, 55, LABEL_MOD_Y + SECOND_EXT_MOD_Y, nullptr);
|
|
216
|
+ labelExt2Target = lv_label_create(scr, 55, LABEL_MOD_Y + SECOND_EXT_MOD_Y, nullptr);
|
|
217
|
+ #endif
|
|
218
|
+
|
|
219
|
+ #if HAS_HEATED_BED
|
|
220
|
+ labelBed = lv_label_create(scr, 210, LABEL_MOD_Y, nullptr);
|
|
221
|
+ labelBedTarget = lv_label_create(scr, 210, LABEL_MOD_Y, nullptr);
|
|
222
|
+ #endif
|
|
223
|
+
|
|
224
|
+ labelFan = lv_label_create(scr, 380, 80, nullptr);
|
|
225
|
+
|
|
226
|
+ sprintf_P(buf, PSTR("%d"), thermalManager.degHotend(0));
|
|
227
|
+ lv_label_set_text(labelExt1, buf);
|
|
228
|
+ lv_obj_align(labelExt1, buttonExt1, LV_ALIGN_CENTER, 0, LABEL_MOD_Y);
|
|
229
|
+ sprintf_P(buf, PSTR("-> %d"), thermalManager.degTargetHotend(0));
|
|
230
|
+ lv_label_set_text(labelExt1Target, buf);
|
|
231
|
+ lv_obj_align(labelExt1Target, buttonExt1, LV_ALIGN_CENTER, 0, TARGET_LABEL_MOD_Y);
|
|
232
|
+
|
|
233
|
+ #if HAS_MULTI_EXTRUDER
|
|
234
|
+ sprintf_P(buf, PSTR("%d"), thermalManager.degHotend(1));
|
|
235
|
+ lv_label_set_text(labelExt2, buf);
|
|
236
|
+ lv_obj_align(labelExt2, buttonExt2, LV_ALIGN_CENTER, 0, LABEL_MOD_Y);
|
|
237
|
+ sprintf_P(buf, PSTR("-> %d"), thermalManager.degTargetHotend(1));
|
|
238
|
+ lv_label_set_text(labelExt2Target, buf);
|
|
239
|
+ lv_obj_align(labelExt2Target, buttonExt2, LV_ALIGN_CENTER, 0, TARGET_LABEL_MOD_Y);
|
|
240
|
+ #endif
|
|
241
|
+
|
|
242
|
+ #if HAS_HEATED_BED
|
|
243
|
+ sprintf_P(buf, PSTR("%d"), thermalManager.degBed());
|
|
244
|
+ lv_label_set_text(labelBed, buf);
|
|
245
|
+ lv_obj_align(labelBed, buttonBedstate, LV_ALIGN_CENTER, 0, LABEL_MOD_Y);
|
|
246
|
+ sprintf_P(buf, PSTR("-> %d"), thermalManager.degTargetBed());
|
|
247
|
+ lv_label_set_text(labelBedTarget, buf);
|
|
248
|
+ lv_obj_align(labelBedTarget, buttonBedstate, LV_ALIGN_CENTER, 0, TARGET_LABEL_MOD_Y);
|
|
249
|
+ #endif
|
|
250
|
+
|
|
251
|
+ sprintf_P(buf, PSTR("%d%%"), thermalManager.fanPercent(thermalManager.fan_speed[0]));
|
|
252
|
+ lv_label_set_text(labelFan, buf);
|
|
253
|
+ lv_obj_align(labelFan, buttonFanstate, LV_ALIGN_CENTER, 0, LABEL_MOD_Y);
|
180
|
254
|
}
|
181
|
255
|
|
182
|
256
|
#if ENABLED(TOUCH_SCREEN_CALIBRATION)
|