Browse Source

Print progress enhancements (#14647)

Marcio Teixeira 4 years ago
parent
commit
27c487bab7

+ 4
- 1
Marlin/src/gcode/lcd/M117.cpp View File

@@ -28,6 +28,9 @@
28 28
  */
29 29
 void GcodeSuite::M117() {
30 30
 
31
-  ui.set_status(parser.string_arg);
31
+  if (parser.string_arg && parser.string_arg[0])
32
+    ui.set_status(parser.string_arg);
33
+  else
34
+    ui.reset_status();
32 35
 
33 36
 }

+ 2
- 2
Marlin/src/gcode/lcd/M73.cpp View File

@@ -22,7 +22,7 @@
22 22
 
23 23
 #include "../../inc/MarlinConfig.h"
24 24
 
25
-#if ENABLED(LCD_SET_PROGRESS_MANUALLY) && EITHER(EXTENSIBLE_UI, ULTRA_LCD)
25
+#if ENABLED(LCD_SET_PROGRESS_MANUALLY)
26 26
 
27 27
 #include "../gcode.h"
28 28
 #include "../../lcd/ultralcd.h"
@@ -42,4 +42,4 @@ void GcodeSuite::M73() {
42 42
     ui.set_progress(parser.value_byte());
43 43
 }
44 44
 
45
-#endif // LCD_SET_PROGRESS_MANUALLY && (EXTENSIBLE_UI || ULTRA_LCD)
45
+#endif // LCD_SET_PROGRESS_MANUALLY

+ 5
- 0
Marlin/src/gcode/sdcard/M23.cpp View File

@@ -26,6 +26,7 @@
26 26
 
27 27
 #include "../gcode.h"
28 28
 #include "../../sd/cardreader.h"
29
+#include "../../lcd/ultralcd.h"
29 30
 
30 31
 /**
31 32
  * M23: Open a file
@@ -36,6 +37,10 @@ void GcodeSuite::M23() {
36 37
   // Simplify3D includes the size, so zero out all spaces (#7227)
37 38
   for (char *fn = parser.string_arg; *fn; ++fn) if (*fn == ' ') *fn = '\0';
38 39
   card.openFile(parser.string_arg, true);
40
+
41
+  #if ENABLED(LCD_SET_PROGRESS_MANUALLY)
42
+    ui.set_progress(0);
43
+  #endif
39 44
 }
40 45
 
41 46
 #endif // SDSUPPORT

+ 1
- 1
Marlin/src/gcode/temperature/M104_M109.cpp View File

@@ -125,7 +125,7 @@ void GcodeSuite::M109() {
125 125
         print_job_timer.start();
126 126
     #endif
127 127
 
128
-    #if EITHER(ULTRA_LCD, EXTENSIBLE_UI)
128
+    #if HAS_DISPLAY
129 129
       if (thermalManager.isHeatingHotend(target_extruder) || !no_wait_for_cooling)
130 130
         thermalManager.set_heating_message(target_extruder);
131 131
     #endif

+ 4
- 0
Marlin/src/lcd/menu/menu.cpp View File

@@ -204,6 +204,10 @@ void MarlinUI::goto_screen(screenFunc_t screen, const uint16_t encoder/*=0*/, co
204 204
       lcd_z_fade_height = planner.z_fade_height;
205 205
     #endif
206 206
 
207
+    #if ENABLED(LCD_SET_PROGRESS_MANUALLY)
208
+      progress_reset();
209
+    #endif
210
+
207 211
     #if BOTH(DOUBLECLICK_FOR_Z_BABYSTEPPING, BABYSTEPPING)
208 212
       static millis_t doubleclick_expire_ms = 0;
209 213
       // Going to menu_main from status screen? Remember first click time.

+ 3
- 1
Marlin/src/lcd/ultralcd.cpp View File

@@ -1522,13 +1522,15 @@ void MarlinUI::update() {
1522 1522
     uint8_t MarlinUI::get_progress() {
1523 1523
       #if ENABLED(LCD_SET_PROGRESS_MANUALLY)
1524 1524
         uint8_t &progress = progress_bar_percent;
1525
+        #define _PLIMIT(P) ((P) & 0x7F)
1525 1526
       #else
1527
+        #define _PLIMIT(P) P
1526 1528
         uint8_t progress = 0;
1527 1529
       #endif
1528 1530
       #if ENABLED(SDSUPPORT)
1529 1531
         if (IS_SD_PRINTING()) progress = card.percentDone();
1530 1532
       #endif
1531
-      return progress;
1533
+      return _PLIMIT(progress);
1532 1534
     }
1533 1535
   #endif
1534 1536
 

+ 2
- 0
Marlin/src/lcd/ultralcd.h View File

@@ -298,6 +298,8 @@ public:
298 298
       #if ENABLED(LCD_SET_PROGRESS_MANUALLY)
299 299
         static uint8_t progress_bar_percent;
300 300
         static void set_progress(const uint8_t progress) { progress_bar_percent = _MIN(progress, 100); }
301
+        static void set_progress_done() { set_progress(0x80 + 100); }
302
+        static bool progress_reset() { if (progress_bar_percent & 0x80) set_progress(0); }
301 303
       #endif
302 304
       static uint8_t get_progress();
303 305
     #else

+ 2
- 2
Marlin/src/module/motion.cpp View File

@@ -51,7 +51,7 @@
51 51
   #include "../feature/bltouch.h"
52 52
 #endif
53 53
 
54
-#if EITHER(ULTRA_LCD, EXTENSIBLE_UI)
54
+#if HAS_DISPLAY
55 55
   #include "../lcd/ultralcd.h"
56 56
 #endif
57 57
 
@@ -1044,7 +1044,7 @@ bool axis_unhomed_error(const bool x/*=true*/, const bool y/*=true*/, const bool
1044 1044
     if (zz) SERIAL_CHAR('Z');
1045 1045
     SERIAL_ECHOLNPGM(" " MSG_FIRST);
1046 1046
 
1047
-    #if EITHER(ULTRA_LCD, EXTENSIBLE_UI)
1047
+    #if HAS_DISPLAY
1048 1048
       ui.status_printf_P(0, PSTR(MSG_HOME " %s%s%s " MSG_FIRST), xx ? MSG_X : "", yy ? MSG_Y : "", zz ? MSG_Z : "");
1049 1049
     #endif
1050 1050
     return true;

+ 1
- 1
Marlin/src/module/temperature.cpp View File

@@ -2923,7 +2923,7 @@ void Temperature::isr() {
2923 2923
 
2924 2924
   #endif // AUTO_REPORT_TEMPERATURES
2925 2925
 
2926
-  #if EITHER(ULTRA_LCD, EXTENSIBLE_UI)
2926
+  #if HAS_DISPLAY
2927 2927
     void Temperature::set_heating_message(const uint8_t e) {
2928 2928
       const bool heating = isHeatingHotend(e);
2929 2929
       #if HOTENDS > 1

+ 1
- 1
Marlin/src/module/temperature.h View File

@@ -785,7 +785,7 @@ class Temperature {
785 785
       #endif
786 786
     #endif
787 787
 
788
-    #if EITHER(ULTRA_LCD, EXTENSIBLE_UI)
788
+    #if HAS_DISPLAY
789 789
       static void set_heating_message(const uint8_t e);
790 790
     #endif
791 791
 

+ 1
- 1
Marlin/src/module/tool_change.cpp View File

@@ -982,7 +982,7 @@ void tool_change(const uint8_t tmp_extruder, bool no_move/*=false*/) {
982 982
           singlenozzle_temp[active_extruder] = thermalManager.temp_hotend[0].target;
983 983
           if (singlenozzle_temp[tmp_extruder] && singlenozzle_temp[tmp_extruder] != singlenozzle_temp[active_extruder]) {
984 984
             thermalManager.setTargetHotend(singlenozzle_temp[tmp_extruder], 0);
985
-            #if EITHER(ULTRA_LCD, EXTENSIBLE_UI)
985
+            #if HAS_DISPLAY
986 986
               thermalManager.set_heating_message(0);
987 987
             #endif
988 988
             (void)thermalManager.wait_for_hotend(0, false);  // Wait for heating or cooling

+ 3
- 5
Marlin/src/sd/cardreader.cpp View File

@@ -1008,18 +1008,16 @@ void CardReader::printingHasFinished() {
1008 1008
     #endif
1009 1009
 
1010 1010
     print_job_timer.stop();
1011
-    if (print_job_timer.duration() > 60) queue.inject_P(PSTR("M31"));
1011
+    queue.enqueue_now_P(print_job_timer.duration() > 60 ? PSTR("M31") : PSTR("M117"));
1012 1012
 
1013 1013
     #if ENABLED(SDCARD_SORT_ALPHA)
1014 1014
       presort();
1015 1015
     #endif
1016 1016
 
1017
-    #if EITHER(ULTRA_LCD, EXTENSIBLE_UI) && ENABLED(LCD_SET_PROGRESS_MANUALLY)
1018
-      ui.progress_bar_percent = 0;
1017
+    #if ENABLED(LCD_SET_PROGRESS_MANUALLY)
1018
+      ui.set_progress_done();
1019 1019
     #endif
1020 1020
 
1021
-    ui.reset_status();
1022
-
1023 1021
     #if ENABLED(SD_REPRINT_LAST_SELECTED_FILE)
1024 1022
       ui.reselect_last_file();
1025 1023
     #endif

+ 2
- 2
Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.cpp View File

@@ -31,7 +31,7 @@
31 31
 
32 32
 #include "Sd2Card_FlashDrive.h"
33 33
 
34
-#if EITHER(ULTRA_LCD, EXTENSIBLE_UI)
34
+#if HAS_DISPLAY
35 35
   #include "../../lcd/ultralcd.h"
36 36
 #endif
37 37
 
@@ -63,7 +63,7 @@ void Sd2Card::idle() {
63 63
       SERIAL_ECHOPGM("Starting USB host...");
64 64
       if (!usb.start()) {
65 65
         SERIAL_ECHOPGM(" Failed. Retrying in 2s.");
66
-        #if EITHER(ULTRA_LCD, EXTENSIBLE_UI)
66
+        #if HAS_DISPLAY
67 67
           LCD_MESSAGEPGM("USB start failed");
68 68
         #endif
69 69
         state = USB_HOST_DELAY_INIT;

Loading…
Cancel
Save