|
@@ -33,9 +33,9 @@ using namespace FTDI;
|
33
|
33
|
using namespace Theme;
|
34
|
34
|
|
35
|
35
|
#if ENABLED(TOUCH_UI_PORTRAIT)
|
36
|
|
- #define GRID_ROWS 8
|
|
36
|
+ #define GRID_ROWS 16
|
37
|
37
|
#else
|
38
|
|
- #define GRID_ROWS 8
|
|
38
|
+ #define GRID_ROWS 16
|
39
|
39
|
#endif
|
40
|
40
|
|
41
|
41
|
void StatusScreen::draw_axis_position(draw_mode_t what) {
|
|
@@ -44,19 +44,19 @@ void StatusScreen::draw_axis_position(draw_mode_t what) {
|
44
|
44
|
#define GRID_COLS 3
|
45
|
45
|
|
46
|
46
|
#if ENABLED(TOUCH_UI_PORTRAIT)
|
47
|
|
- #define X_LBL_POS BTN_POS(1,5), BTN_SIZE(1,1)
|
48
|
|
- #define Y_LBL_POS BTN_POS(1,6), BTN_SIZE(1,1)
|
49
|
|
- #define Z_LBL_POS BTN_POS(1,7), BTN_SIZE(1,1)
|
50
|
|
- #define X_VAL_POS BTN_POS(2,5), BTN_SIZE(2,1)
|
51
|
|
- #define Y_VAL_POS BTN_POS(2,6), BTN_SIZE(2,1)
|
52
|
|
- #define Z_VAL_POS BTN_POS(2,7), BTN_SIZE(2,1)
|
|
47
|
+ #define X_LBL_POS BTN_POS(1, 9), BTN_SIZE(1,2)
|
|
48
|
+ #define Y_LBL_POS BTN_POS(1,11), BTN_SIZE(1,2)
|
|
49
|
+ #define Z_LBL_POS BTN_POS(1,13), BTN_SIZE(1,2)
|
|
50
|
+ #define X_VAL_POS BTN_POS(2, 9), BTN_SIZE(2,2)
|
|
51
|
+ #define Y_VAL_POS BTN_POS(2,11), BTN_SIZE(2,2)
|
|
52
|
+ #define Z_VAL_POS BTN_POS(2,13), BTN_SIZE(2,2)
|
53
|
53
|
#else
|
54
|
|
- #define X_LBL_POS BTN_POS(1,5), BTN_SIZE(1,1)
|
55
|
|
- #define Y_LBL_POS BTN_POS(2,5), BTN_SIZE(1,1)
|
56
|
|
- #define Z_LBL_POS BTN_POS(3,5), BTN_SIZE(1,1)
|
57
|
|
- #define X_VAL_POS BTN_POS(1,6), BTN_SIZE(1,1)
|
58
|
|
- #define Y_VAL_POS BTN_POS(2,6), BTN_SIZE(1,1)
|
59
|
|
- #define Z_VAL_POS BTN_POS(3,6), BTN_SIZE(1,1)
|
|
54
|
+ #define X_LBL_POS BTN_POS(1, 9), BTN_SIZE(1,2)
|
|
55
|
+ #define Y_LBL_POS BTN_POS(2, 9), BTN_SIZE(1,2)
|
|
56
|
+ #define Z_LBL_POS BTN_POS(3, 9), BTN_SIZE(1,2)
|
|
57
|
+ #define X_VAL_POS BTN_POS(1,11), BTN_SIZE(1,2)
|
|
58
|
+ #define Y_VAL_POS BTN_POS(2,11), BTN_SIZE(1,2)
|
|
59
|
+ #define Z_VAL_POS BTN_POS(3,11), BTN_SIZE(1,2)
|
60
|
60
|
#endif
|
61
|
61
|
|
62
|
62
|
#define _UNION_POS(x1,y1,w1,h1,x2,y2,w2,h2) x1,y1,max(x1+w1,x2+w2)-x1,max(y1+h1,y2+h2)-y1
|
|
@@ -103,9 +103,9 @@ void StatusScreen::draw_axis_position(draw_mode_t what) {
|
103
|
103
|
|
104
|
104
|
cmd.tag(6)
|
105
|
105
|
.font(Theme::font_medium)
|
106
|
|
- .text ( X_VAL_POS, x_str)
|
107
|
|
- .text ( Y_VAL_POS, y_str)
|
108
|
|
- .text ( Z_VAL_POS, z_str);
|
|
106
|
+ .text(X_VAL_POS, x_str)
|
|
107
|
+ .text(Y_VAL_POS, y_str)
|
|
108
|
+ .text(Z_VAL_POS, z_str);
|
109
|
109
|
}
|
110
|
110
|
|
111
|
111
|
#undef GRID_COLS
|
|
@@ -120,12 +120,12 @@ void StatusScreen::draw_axis_position(draw_mode_t what) {
|
120
|
120
|
void StatusScreen::draw_temperature(draw_mode_t what) {
|
121
|
121
|
using namespace Theme;
|
122
|
122
|
|
123
|
|
- #define TEMP_RECT_1 BTN_POS(1,1), BTN_SIZE(4,2)
|
124
|
|
- #define TEMP_RECT_2 BTN_POS(1,1), BTN_SIZE(8,1)
|
125
|
|
- #define NOZ_1_POS BTN_POS(1,1), BTN_SIZE(4,1)
|
126
|
|
- #define NOZ_2_POS BTN_POS(5,1), BTN_SIZE(4,1)
|
127
|
|
- #define BED_POS BTN_POS(1,2), BTN_SIZE(4,1)
|
128
|
|
- #define FAN_POS BTN_POS(5,2), BTN_SIZE(4,1)
|
|
123
|
+ #define TEMP_RECT_1 BTN_POS(1,1), BTN_SIZE(4,4)
|
|
124
|
+ #define TEMP_RECT_2 BTN_POS(1,1), BTN_SIZE(8,2)
|
|
125
|
+ #define NOZ_1_POS BTN_POS(1,1), BTN_SIZE(4,2)
|
|
126
|
+ #define NOZ_2_POS BTN_POS(5,1), BTN_SIZE(4,2)
|
|
127
|
+ #define BED_POS BTN_POS(1,3), BTN_SIZE(4,2)
|
|
128
|
+ #define FAN_POS BTN_POS(5,3), BTN_SIZE(4,2)
|
129
|
129
|
|
130
|
130
|
#define _ICON_POS(x,y,w,h) x, y, w/4, h
|
131
|
131
|
#define _TEXT_POS(x,y,w,h) x + w/4, y, w - w/4, h
|
|
@@ -164,17 +164,12 @@ void StatusScreen::draw_temperature(draw_mode_t what) {
|
164
|
164
|
.cmd (BITMAP_SIZE (Fan_Icon_Info))
|
165
|
165
|
.icon(ICON_POS(FAN_POS), Fan_Icon_Info, icon_scale);
|
166
|
166
|
|
167
|
|
- #if ENABLED(TOUCH_UI_USE_UTF8)
|
168
|
|
- load_utf8_bitmaps(cmd); // Restore font bitmap handles
|
169
|
|
- #endif
|
|
167
|
+ TERN_(TOUCH_UI_USE_UTF8, load_utf8_bitmaps(cmd)); // Restore font bitmap handles
|
170
|
168
|
}
|
171
|
169
|
|
172
|
170
|
if (what & FOREGROUND) {
|
173
|
171
|
using namespace ExtUI;
|
174
|
|
- char e0_str[20];
|
175
|
|
- char e1_str[20];
|
176
|
|
- char bed_str[20];
|
177
|
|
- char fan_str[20];
|
|
172
|
+ char e0_str[20], e1_str[20], bed_str[20], fan_str[20];
|
178
|
173
|
|
179
|
174
|
sprintf_P(fan_str, PSTR("%-3d %%"), int8_t(getActualFan_percent(FAN0)));
|
180
|
175
|
|
|
@@ -188,7 +183,6 @@ void StatusScreen::draw_temperature(draw_mode_t what) {
|
188
|
183
|
else
|
189
|
184
|
format_temp_and_temp(e0_str, getActualTemp_celsius(H0), getTargetTemp_celsius(H0));
|
190
|
185
|
|
191
|
|
-
|
192
|
186
|
#if HAS_MULTI_EXTRUDER
|
193
|
187
|
if (isHeaterIdle(H1))
|
194
|
188
|
format_temp_and_idle(e1_str, getActualTemp_celsius(H1));
|
|
@@ -207,45 +201,102 @@ void StatusScreen::draw_temperature(draw_mode_t what) {
|
207
|
201
|
}
|
208
|
202
|
}
|
209
|
203
|
|
|
204
|
+void StatusScreen::_format_time(char *outstr, uint32_t time) {
|
|
205
|
+ const uint8_t hrs = time / 3600,
|
|
206
|
+ min = (time / 60) % 60,
|
|
207
|
+ sec = time % 60;
|
|
208
|
+ if (hrs)
|
|
209
|
+ sprintf_P(outstr, PSTR("%02d:%02d"), hrs, min);
|
|
210
|
+ else
|
|
211
|
+ sprintf_P(outstr, PSTR("%02d:%02ds"), min, sec);
|
|
212
|
+}
|
|
213
|
+
|
210
|
214
|
void StatusScreen::draw_progress(draw_mode_t what) {
|
211
|
215
|
using namespace ExtUI;
|
212
|
216
|
using namespace Theme;
|
213
|
217
|
|
214
|
218
|
CommandProcessor cmd;
|
215
|
219
|
|
|
220
|
+ #undef GRID_COLS
|
216
|
221
|
#if ENABLED(TOUCH_UI_PORTRAIT)
|
217
|
|
- #define TIME_POS BTN_POS(1,3), BTN_SIZE(4,1)
|
218
|
|
- #define PROGRESS_POS BTN_POS(5,3), BTN_SIZE(4,1)
|
|
222
|
+ #define GRID_COLS 3
|
|
223
|
+ #define PROGRESSZONE_POS BTN_POS(1,5), BTN_SIZE(3,2)
|
|
224
|
+ #define TIME_POS_X BTN_X(1)
|
|
225
|
+ #define TIME_POS_W BTN_W(1)
|
|
226
|
+ #define REMAINING_POS_X BTN_X(2)
|
|
227
|
+ #define REMAINING_POS_W BTN_W(1)
|
|
228
|
+ #define PROGRESS_POS_X BTN_X(3)
|
|
229
|
+ #define PROGRESS_POS_W BTN_W(1)
|
|
230
|
+ #define PROGRESSZONE_FIRSTLINE_Y BTN_Y(5)
|
|
231
|
+ #define PROGRESSBAR_POS BTN_POS(1,6), BTN_SIZE(3,1)
|
219
|
232
|
#else
|
220
|
|
- #define TIME_POS BTN_POS(9,1), BTN_SIZE(4,1)
|
221
|
|
- #define PROGRESS_POS BTN_POS(9,2), BTN_SIZE(4,1)
|
|
233
|
+ #define GRID_COLS 6
|
|
234
|
+ #define PROGRESSZONE_POS BTN_POS(5,1), BTN_SIZE(2,4)
|
|
235
|
+ #if ENABLED(SHOW_REMAINING_TIME)
|
|
236
|
+ #define TIME_POS BTN_POS(5,1), BTN_SIZE(1,2)
|
|
237
|
+ #define REMAINING_POS BTN_POS(6,1), BTN_SIZE(1,2)
|
|
238
|
+ #else
|
|
239
|
+ #define TIME_POS BTN_POS(5,1), BTN_SIZE(2,2)
|
|
240
|
+ #endif
|
|
241
|
+ #define PROGRESS_POS BTN_POS(5,3), BTN_SIZE(2,2)
|
|
242
|
+ #define PROGRESSBAR_POS BTN_POS(5,2), BTN_SIZE(2,2)
|
222
|
243
|
#endif
|
223
|
244
|
|
224
|
245
|
if (what & BACKGROUND) {
|
225
|
246
|
cmd.tag(0).font(font_medium)
|
226
|
|
- .fgcolor(progress).button(TIME_POS, F(""), OPT_FLAT)
|
227
|
|
- .button(PROGRESS_POS, F(""), OPT_FLAT);
|
|
247
|
+ .fgcolor(progress).button(PROGRESSZONE_POS, F(""), OPT_FLAT);
|
228
|
248
|
}
|
229
|
249
|
|
230
|
250
|
if (what & FOREGROUND) {
|
231
|
251
|
const uint32_t elapsed = getProgress_seconds_elapsed();
|
232
|
|
- const uint8_t hrs = elapsed/3600;
|
233
|
|
- const uint8_t min = (elapsed/60)%60;
|
|
252
|
+ char elapsed_str[10];
|
|
253
|
+ _format_time(elapsed_str, elapsed);
|
234
|
254
|
|
235
|
|
- char time_str[10];
|
236
|
|
- char progress_str[10];
|
|
255
|
+ #if ENABLED(SHOW_REMAINING_TIME)
|
|
256
|
+ const uint32_t remaining = getProgress_seconds_remaining();
|
|
257
|
+ char remaining_str[10];
|
|
258
|
+ _format_time(remaining_str, remaining);
|
|
259
|
+ #endif
|
237
|
260
|
|
238
|
|
- sprintf_P(time_str, PSTR(" %02d : %02d"), hrs, min);
|
239
|
|
- sprintf_P(progress_str, PSTR("%-3d %%"), getProgress_percent() );
|
|
261
|
+ const uint16_t current_progress = TERN(HAS_PRINT_PROGRESS_PERMYRIAD, getProgress_permyriad(), getProgress_percent() * 100);
|
|
262
|
+ constexpr uint16_t progress_range = 10000U;
|
240
|
263
|
|
241
|
|
- cmd.font(font_medium)
|
242
|
|
- .tag(7).text(TIME_POS, time_str)
|
243
|
|
- .text(PROGRESS_POS, progress_str);
|
244
|
|
- }
|
245
|
|
-}
|
|
264
|
+ const bool show_progress_bar = current_progress > 0 && current_progress < progress_range + 1;
|
|
265
|
+ if (show_progress_bar) {
|
|
266
|
+ cmd.tag(0).font(font_medium)
|
|
267
|
+ .bgcolor(progress)
|
|
268
|
+ .progress(PROGRESSBAR_POS, current_progress, progress_range, OPT_FLAT);
|
|
269
|
+ }
|
246
|
270
|
|
247
|
|
-#undef GRID_COLS
|
|
271
|
+ char progress_str[10];
|
|
272
|
+ sprintf_P(progress_str,
|
|
273
|
+ #if ENABLED(PRINT_PROGRESS_SHOW_DECIMALS)
|
|
274
|
+ PSTR("%3d.%02d%%"), uint8_t(current_progress / 100), current_progress % 100
|
|
275
|
+ #else
|
|
276
|
+ PSTR("%3d%%"), uint8_t(current_progress / 100)
|
|
277
|
+ #endif
|
|
278
|
+ );
|
|
279
|
+
|
|
280
|
+ #if ENABLED(TOUCH_UI_PORTRAIT)
|
|
281
|
+ const uint16_t texts_pos_h = show_progress_bar ? (BTN_H(1)) : (BTN_H(2));
|
|
282
|
+ cmd.font(font_medium)
|
|
283
|
+ .tag(7).text(TIME_POS_X, PROGRESSZONE_FIRSTLINE_Y, TIME_POS_W, texts_pos_h, elapsed_str)
|
|
284
|
+ #if ENABLED(SHOW_REMAINING_TIME)
|
|
285
|
+ .text(REMAINING_POS_X, PROGRESSZONE_FIRSTLINE_Y, REMAINING_POS_W, texts_pos_h, remaining_str)
|
|
286
|
+ #endif
|
|
287
|
+ .text(PROGRESS_POS_X, PROGRESSZONE_FIRSTLINE_Y, PROGRESS_POS_W, texts_pos_h, progress_str);
|
|
288
|
+ #else
|
|
289
|
+ cmd.font(font_medium)
|
|
290
|
+ .tag(7).text(TIME_POS, elapsed_str)
|
|
291
|
+ #if ENABLED(SHOW_REMAINING_TIME)
|
|
292
|
+ .text(REMAINING_POS, remaining_str)
|
|
293
|
+ #endif
|
|
294
|
+ .text(PROGRESS_POS, progress_str);
|
|
295
|
+ #endif
|
|
296
|
+ }
|
248
|
297
|
|
|
298
|
+ #undef GRID_COLS
|
|
299
|
+}
|
249
|
300
|
|
250
|
301
|
void StatusScreen::draw_interaction_buttons(draw_mode_t what) {
|
251
|
302
|
#define GRID_COLS 4
|
|
@@ -253,11 +304,11 @@ void StatusScreen::draw_interaction_buttons(draw_mode_t what) {
|
253
|
304
|
using namespace ExtUI;
|
254
|
305
|
|
255
|
306
|
#if ENABLED(TOUCH_UI_PORTRAIT)
|
256
|
|
- #define MEDIA_BTN_POS BTN_POS(1,8), BTN_SIZE(2,1)
|
257
|
|
- #define MENU_BTN_POS BTN_POS(3,8), BTN_SIZE(2,1)
|
|
307
|
+ #define MEDIA_BTN_POS BTN_POS(1,15), BTN_SIZE(2,2)
|
|
308
|
+ #define MENU_BTN_POS BTN_POS(3,15), BTN_SIZE(2,2)
|
258
|
309
|
#else
|
259
|
|
- #define MEDIA_BTN_POS BTN_POS(1,7), BTN_SIZE(2,2)
|
260
|
|
- #define MENU_BTN_POS BTN_POS(3,7), BTN_SIZE(2,2)
|
|
310
|
+ #define MEDIA_BTN_POS BTN_POS(1,13), BTN_SIZE(2,4)
|
|
311
|
+ #define MENU_BTN_POS BTN_POS(3,13), BTN_SIZE(2,4)
|
261
|
312
|
#endif
|
262
|
313
|
|
263
|
314
|
const bool has_media = isMediaInserted() && !isPrintingFromMedia();
|
|
@@ -278,9 +329,9 @@ void StatusScreen::draw_status_message(draw_mode_t what, const char* message) {
|
278
|
329
|
#define GRID_COLS 1
|
279
|
330
|
|
280
|
331
|
#if ENABLED(TOUCH_UI_PORTRAIT)
|
281
|
|
- #define STATUS_POS BTN_POS(1,4), BTN_SIZE(1,1)
|
|
332
|
+ #define STATUS_POS BTN_POS(1,7), BTN_SIZE(1,2)
|
282
|
333
|
#else
|
283
|
|
- #define STATUS_POS BTN_POS(1,3), BTN_SIZE(1,2)
|
|
334
|
+ #define STATUS_POS BTN_POS(1,5), BTN_SIZE(1,4)
|
284
|
335
|
#endif
|
285
|
336
|
|
286
|
337
|
if (what & BACKGROUND) {
|