Sfoglia il codice sorgente

Remaining Time for FTDI EVE, bp for ExtUI (#20549)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
LinFor 3 anni fa
parent
commit
2d88a2cfb7
Nessun account collegato all'indirizzo email del committer

+ 16
- 14
Marlin/Configuration_adv.h Vedi File

1134
 
1134
 
1135
 #endif // HAS_LCD_MENU
1135
 #endif // HAS_LCD_MENU
1136
 
1136
 
1137
-// Scroll a longer status message into view
1138
-//#define STATUS_MESSAGE_SCROLLING
1137
+#if HAS_DISPLAY
1138
+  // The timeout (in ms) to return to the status screen from sub-menus
1139
+  //#define LCD_TIMEOUT_TO_STATUS 15000
1139
 
1140
 
1140
-// On the Info Screen, display XY with one decimal place when possible
1141
-//#define LCD_DECIMAL_SMALL_XY
1141
+  #if ENABLED(SHOW_BOOTSCREEN)
1142
+    #define BOOTSCREEN_TIMEOUT 4000      // (ms) Total Duration to display the boot screen(s)
1143
+  #endif
1142
 
1144
 
1143
-// The timeout (in ms) to return to the status screen from sub-menus
1144
-//#define LCD_TIMEOUT_TO_STATUS 15000
1145
+  // Scroll a longer status message into view
1146
+  //#define STATUS_MESSAGE_SCROLLING
1145
 
1147
 
1146
-// Add an 'M73' G-code to set the current percentage
1147
-//#define LCD_SET_PROGRESS_MANUALLY
1148
+  // On the Info Screen, display XY with one decimal place when possible
1149
+  //#define LCD_DECIMAL_SMALL_XY
1148
 
1150
 
1149
-// Show the E position (filament used) during printing
1150
-//#define LCD_SHOW_E_TOTAL
1151
+  // Add an 'M73' G-code to set the current percentage
1152
+  //#define LCD_SET_PROGRESS_MANUALLY
1151
 
1153
 
1152
-#if ENABLED(SHOW_BOOTSCREEN)
1153
-  #define BOOTSCREEN_TIMEOUT 4000        // (ms) Total Duration to display the boot screen(s)
1154
+  // Show the E position (filament used) during printing
1155
+  //#define LCD_SHOW_E_TOTAL
1154
 #endif
1156
 #endif
1155
 
1157
 
1156
-#if EITHER(SDSUPPORT, LCD_SET_PROGRESS_MANUALLY) && ANY(HAS_MARLINUI_U8GLIB, HAS_MARLINUI_HD44780, IS_TFTGLCD_PANEL)
1158
+#if EITHER(SDSUPPORT, LCD_SET_PROGRESS_MANUALLY) && ANY(HAS_MARLINUI_U8GLIB, HAS_MARLINUI_HD44780, IS_TFTGLCD_PANEL, EXTENSIBLE_UI)
1157
   //#define SHOW_REMAINING_TIME       // Display estimated time to completion
1159
   //#define SHOW_REMAINING_TIME       // Display estimated time to completion
1158
   #if ENABLED(SHOW_REMAINING_TIME)
1160
   #if ENABLED(SHOW_REMAINING_TIME)
1159
     //#define USE_M73_REMAINING_TIME  // Use remaining time from M73 command instead of estimation
1161
     //#define USE_M73_REMAINING_TIME  // Use remaining time from M73 command instead of estimation
1160
     //#define ROTATE_PROGRESS_DISPLAY // Display (P)rogress, (E)lapsed, and (R)emaining time
1162
     //#define ROTATE_PROGRESS_DISPLAY // Display (P)rogress, (E)lapsed, and (R)emaining time
1161
   #endif
1163
   #endif
1162
 
1164
 
1163
-  #if HAS_MARLINUI_U8GLIB
1165
+  #if EITHER(HAS_MARLINUI_U8GLIB, EXTENSIBLE_UI)
1164
     //#define PRINT_PROGRESS_SHOW_DECIMALS // Show progress with decimal digits
1166
     //#define PRINT_PROGRESS_SHOW_DECIMALS // Show progress with decimal digits
1165
   #endif
1167
   #endif
1166
 
1168
 

+ 2
- 4
Marlin/src/inc/SanityCheck.h Vedi File

3211
   #undef _PIN_CONFLICT
3211
   #undef _PIN_CONFLICT
3212
 #endif
3212
 #endif
3213
 
3213
 
3214
-#if !HAS_MARLINUI_U8GLIB
3215
-  #if ENABLED(PRINT_PROGRESS_SHOW_DECIMALS)
3216
-    #error "PRINT_PROGRESS_SHOW_DECIMALS currently requires a Graphical LCD."
3217
-  #endif
3214
+#if NONE(HAS_MARLINUI_U8GLIB, EXTENSIBLE_UI) && ENABLED(PRINT_PROGRESS_SHOW_DECIMALS)
3215
+  #error "PRINT_PROGRESS_SHOW_DECIMALS currently requires a Graphical LCD."
3218
 #endif
3216
 #endif
3219
 
3217
 
3220
 #if HAS_ADC_BUTTONS && defined(ADC_BUTTON_DEBOUNCE_DELAY) && ADC_BUTTON_DEBOUNCE_DELAY < 16
3218
 #if HAS_ADC_BUTTONS && defined(ADC_BUTTON_DEBOUNCE_DELAY) && ADC_BUTTON_DEBOUNCE_DELAY < 16

+ 1
- 1
Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screens.h Vedi File

277
     static void draw_progress(draw_mode_t);
277
     static void draw_progress(draw_mode_t);
278
     static void draw_interaction_buttons(draw_mode_t);
278
     static void draw_interaction_buttons(draw_mode_t);
279
     static void draw_status_message(draw_mode_t, const char * const);
279
     static void draw_status_message(draw_mode_t, const char * const);
280
-
280
+    static void _format_time(char *outstr, uint32_t time);
281
   public:
281
   public:
282
     static void loadBitmaps();
282
     static void loadBitmaps();
283
     static void setStatusMessage(const char *);
283
     static void setStatusMessage(const char *);

+ 106
- 55
Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/status_screen.cpp Vedi File

33
 using namespace Theme;
33
 using namespace Theme;
34
 
34
 
35
 #if ENABLED(TOUCH_UI_PORTRAIT)
35
 #if ENABLED(TOUCH_UI_PORTRAIT)
36
-    #define GRID_ROWS 8
36
+  #define GRID_ROWS 16
37
 #else
37
 #else
38
-    #define GRID_ROWS 8
38
+  #define GRID_ROWS 16
39
 #endif
39
 #endif
40
 
40
 
41
 void StatusScreen::draw_axis_position(draw_mode_t what) {
41
 void StatusScreen::draw_axis_position(draw_mode_t what) {
44
   #define GRID_COLS 3
44
   #define GRID_COLS 3
45
 
45
 
46
   #if ENABLED(TOUCH_UI_PORTRAIT)
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
   #else
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
   #endif
60
   #endif
61
 
61
 
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
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
 
103
 
104
     cmd.tag(6)
104
     cmd.tag(6)
105
        .font(Theme::font_medium)
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
   #undef GRID_COLS
111
   #undef GRID_COLS
120
 void StatusScreen::draw_temperature(draw_mode_t what) {
120
 void StatusScreen::draw_temperature(draw_mode_t what) {
121
   using namespace Theme;
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
   #define _ICON_POS(x,y,w,h) x, y, w/4, h
130
   #define _ICON_POS(x,y,w,h) x, y, w/4, h
131
   #define _TEXT_POS(x,y,w,h) x + w/4, y, w - w/4, h
131
   #define _TEXT_POS(x,y,w,h) x + w/4, y, w - w/4, h
164
        .cmd (BITMAP_SIZE  (Fan_Icon_Info))
164
        .cmd (BITMAP_SIZE  (Fan_Icon_Info))
165
        .icon(ICON_POS(FAN_POS), Fan_Icon_Info, icon_scale);
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
   if (what & FOREGROUND) {
170
   if (what & FOREGROUND) {
173
     using namespace ExtUI;
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
     sprintf_P(fan_str, PSTR("%-3d %%"), int8_t(getActualFan_percent(FAN0)));
174
     sprintf_P(fan_str, PSTR("%-3d %%"), int8_t(getActualFan_percent(FAN0)));
180
 
175
 
188
     else
183
     else
189
       format_temp_and_temp(e0_str, getActualTemp_celsius(H0), getTargetTemp_celsius(H0));
184
       format_temp_and_temp(e0_str, getActualTemp_celsius(H0), getTargetTemp_celsius(H0));
190
 
185
 
191
-
192
     #if HAS_MULTI_EXTRUDER
186
     #if HAS_MULTI_EXTRUDER
193
       if (isHeaterIdle(H1))
187
       if (isHeaterIdle(H1))
194
         format_temp_and_idle(e1_str, getActualTemp_celsius(H1));
188
         format_temp_and_idle(e1_str, getActualTemp_celsius(H1));
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
 void StatusScreen::draw_progress(draw_mode_t what) {
214
 void StatusScreen::draw_progress(draw_mode_t what) {
211
   using namespace ExtUI;
215
   using namespace ExtUI;
212
   using namespace Theme;
216
   using namespace Theme;
213
 
217
 
214
   CommandProcessor cmd;
218
   CommandProcessor cmd;
215
 
219
 
220
+  #undef GRID_COLS
216
   #if ENABLED(TOUCH_UI_PORTRAIT)
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
   #else
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
   #endif
243
   #endif
223
 
244
 
224
   if (what & BACKGROUND) {
245
   if (what & BACKGROUND) {
225
     cmd.tag(0).font(font_medium)
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
   if (what & FOREGROUND) {
250
   if (what & FOREGROUND) {
231
     const uint32_t elapsed = getProgress_seconds_elapsed();
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
 void StatusScreen::draw_interaction_buttons(draw_mode_t what) {
301
 void StatusScreen::draw_interaction_buttons(draw_mode_t what) {
251
   #define GRID_COLS 4
302
   #define GRID_COLS 4
253
     using namespace ExtUI;
304
     using namespace ExtUI;
254
 
305
 
255
   #if ENABLED(TOUCH_UI_PORTRAIT)
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
   #else
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
   #endif
312
   #endif
262
 
313
 
263
     const bool has_media = isMediaInserted() && !isPrintingFromMedia();
314
     const bool has_media = isMediaInserted() && !isPrintingFromMedia();
278
   #define GRID_COLS 1
329
   #define GRID_COLS 1
279
 
330
 
280
   #if ENABLED(TOUCH_UI_PORTRAIT)
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
   #else
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
   #endif
335
   #endif
285
 
336
 
286
   if (what & BACKGROUND) {
337
   if (what & BACKGROUND) {

+ 1
- 5
Marlin/src/lcd/extui/ui_api.cpp Vedi File

245
   }
245
   }
246
 
246
 
247
   #ifdef TOUCH_UI_LCD_TEMP_SCALING
247
   #ifdef TOUCH_UI_LCD_TEMP_SCALING
248
-    #define GET_TEMP_ADJUSTMENT(A) float(A)/TOUCH_UI_LCD_TEMP_SCALING
248
+    #define GET_TEMP_ADJUSTMENT(A) (float(A) / (TOUCH_UI_LCD_TEMP_SCALING))
249
   #else
249
   #else
250
     #define GET_TEMP_ADJUSTMENT(A) A
250
     #define GET_TEMP_ADJUSTMENT(A) A
251
   #endif
251
   #endif
807
     #endif
807
     #endif
808
   #endif
808
   #endif
809
 
809
 
810
-  uint8_t getProgress_percent() {
811
-    return ui.get_progress_percent();
812
-  }
813
-
814
   uint32_t getProgress_seconds_elapsed() {
810
   uint32_t getProgress_seconds_elapsed() {
815
     const duration_t elapsed = print_job_timer.duration();
811
     const duration_t elapsed = print_job_timer.duration();
816
     return elapsed.value;
812
     return elapsed.value;

+ 12
- 1
Marlin/src/lcd/extui/ui_api.h Vedi File

43
  ****************************************************************************/
43
  ****************************************************************************/
44
 
44
 
45
 #include "../../inc/MarlinConfig.h"
45
 #include "../../inc/MarlinConfig.h"
46
+#include "../marlinui.h"
46
 
47
 
47
 namespace ExtUI {
48
 namespace ExtUI {
48
 
49
 
129
   float getTravelAcceleration_mm_s2();
130
   float getTravelAcceleration_mm_s2();
130
   float getFeedrate_percent();
131
   float getFeedrate_percent();
131
   int16_t getFlowPercentage(const extruder_t);
132
   int16_t getFlowPercentage(const extruder_t);
132
-  uint8_t getProgress_percent();
133
+
134
+  inline uint8_t getProgress_percent() { return ui.get_progress_percent(); }
135
+
136
+  #if HAS_PRINT_PROGRESS_PERMYRIAD
137
+    inline uint16_t getProgress_permyriad() { return ui.get_progress_permyriad(); }
138
+  #endif
139
+
133
   uint32_t getProgress_seconds_elapsed();
140
   uint32_t getProgress_seconds_elapsed();
134
 
141
 
142
+  #if ENABLED(SHOW_REMAINING_TIME)
143
+    inline uint32_t getProgress_seconds_remaining() { return ui.get_remaining_time(); }
144
+  #endif
145
+
135
   #if HAS_LEVELING
146
   #if HAS_LEVELING
136
     bool getLevelingActive();
147
     bool getLevelingActive();
137
     void setLevelingActive(const bool);
148
     void setLevelingActive(const bool);

+ 18
- 5
Marlin/src/lcd/marlinui.h Vedi File

57
   #define MULTI_MANUAL 1
57
   #define MULTI_MANUAL 1
58
 #endif
58
 #endif
59
 
59
 
60
+#if HAS_DISPLAY
61
+  #include "../module/printcounter.h"
62
+#endif
63
+
60
 #if HAS_WIRED_LCD
64
 #if HAS_WIRED_LCD
61
 
65
 
62
   #include "../MarlinCore.h"
66
   #include "../MarlinCore.h"
357
       static void set_progress(const progress_t p) { progress_override = _MIN(p, 100U * (PROGRESS_SCALE)); }
361
       static void set_progress(const progress_t p) { progress_override = _MIN(p, 100U * (PROGRESS_SCALE)); }
358
       static void set_progress_done() { progress_override = (PROGRESS_MASK + 1U) + 100U * (PROGRESS_SCALE); }
362
       static void set_progress_done() { progress_override = (PROGRESS_MASK + 1U) + 100U * (PROGRESS_SCALE); }
359
       static void progress_reset() { if (progress_override & (PROGRESS_MASK + 1U)) set_progress(0); }
363
       static void progress_reset() { if (progress_override & (PROGRESS_MASK + 1U)) set_progress(0); }
360
-      #if BOTH(LCD_SET_PROGRESS_MANUALLY, USE_M73_REMAINING_TIME)
361
-        static uint32_t remaining_time;
362
-        FORCE_INLINE static void set_remaining_time(const uint32_t r) { remaining_time = r; }
363
-        FORCE_INLINE static uint32_t get_remaining_time() { return remaining_time; }
364
-        FORCE_INLINE static void reset_remaining_time() { set_remaining_time(0); }
364
+      #if ENABLED(SHOW_REMAINING_TIME)
365
+        static inline uint32_t _calculated_remaining_time() {
366
+          const duration_t elapsed = print_job_timer.duration();
367
+          const progress_t progress = _get_progress();
368
+          return elapsed.value * (100 * (PROGRESS_SCALE) - progress) / progress;
369
+        }
370
+        #if ENABLED(USE_M73_REMAINING_TIME)
371
+          static uint32_t remaining_time;
372
+          FORCE_INLINE static void set_remaining_time(const uint32_t r) { remaining_time = r; }
373
+          FORCE_INLINE static uint32_t get_remaining_time() { return remaining_time ?: _calculated_remaining_time(); }
374
+          FORCE_INLINE static void reset_remaining_time() { set_remaining_time(0); }
375
+        #else
376
+          FORCE_INLINE static uint32_t get_remaining_time() { return _calculated_remaining_time(); }
377
+        #endif
365
       #endif
378
       #endif
366
     #endif
379
     #endif
367
     static progress_t _get_progress();
380
     static progress_t _get_progress();

Loading…
Annulla
Salva