Browse Source

Print progress enhancements (#14647)

Marcio Teixeira 6 years ago
parent
commit
27c487bab7

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

28
  */
28
  */
29
 void GcodeSuite::M117() {
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
 
22
 
23
 #include "../../inc/MarlinConfig.h"
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
 #include "../gcode.h"
27
 #include "../gcode.h"
28
 #include "../../lcd/ultralcd.h"
28
 #include "../../lcd/ultralcd.h"
42
     ui.set_progress(parser.value_byte());
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
 
26
 
27
 #include "../gcode.h"
27
 #include "../gcode.h"
28
 #include "../../sd/cardreader.h"
28
 #include "../../sd/cardreader.h"
29
+#include "../../lcd/ultralcd.h"
29
 
30
 
30
 /**
31
 /**
31
  * M23: Open a file
32
  * M23: Open a file
36
   // Simplify3D includes the size, so zero out all spaces (#7227)
37
   // Simplify3D includes the size, so zero out all spaces (#7227)
37
   for (char *fn = parser.string_arg; *fn; ++fn) if (*fn == ' ') *fn = '\0';
38
   for (char *fn = parser.string_arg; *fn; ++fn) if (*fn == ' ') *fn = '\0';
38
   card.openFile(parser.string_arg, true);
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
 #endif // SDSUPPORT
46
 #endif // SDSUPPORT

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

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

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

204
       lcd_z_fade_height = planner.z_fade_height;
204
       lcd_z_fade_height = planner.z_fade_height;
205
     #endif
205
     #endif
206
 
206
 
207
+    #if ENABLED(LCD_SET_PROGRESS_MANUALLY)
208
+      progress_reset();
209
+    #endif
210
+
207
     #if BOTH(DOUBLECLICK_FOR_Z_BABYSTEPPING, BABYSTEPPING)
211
     #if BOTH(DOUBLECLICK_FOR_Z_BABYSTEPPING, BABYSTEPPING)
208
       static millis_t doubleclick_expire_ms = 0;
212
       static millis_t doubleclick_expire_ms = 0;
209
       // Going to menu_main from status screen? Remember first click time.
213
       // Going to menu_main from status screen? Remember first click time.

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

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

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

298
       #if ENABLED(LCD_SET_PROGRESS_MANUALLY)
298
       #if ENABLED(LCD_SET_PROGRESS_MANUALLY)
299
         static uint8_t progress_bar_percent;
299
         static uint8_t progress_bar_percent;
300
         static void set_progress(const uint8_t progress) { progress_bar_percent = _MIN(progress, 100); }
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
       #endif
303
       #endif
302
       static uint8_t get_progress();
304
       static uint8_t get_progress();
303
     #else
305
     #else

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

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

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

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

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

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

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

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

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

1008
     #endif
1008
     #endif
1009
 
1009
 
1010
     print_job_timer.stop();
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
     #if ENABLED(SDCARD_SORT_ALPHA)
1013
     #if ENABLED(SDCARD_SORT_ALPHA)
1014
       presort();
1014
       presort();
1015
     #endif
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
     #endif
1019
     #endif
1020
 
1020
 
1021
-    ui.reset_status();
1022
-
1023
     #if ENABLED(SD_REPRINT_LAST_SELECTED_FILE)
1021
     #if ENABLED(SD_REPRINT_LAST_SELECTED_FILE)
1024
       ui.reselect_last_file();
1022
       ui.reselect_last_file();
1025
     #endif
1023
     #endif

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

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

Loading…
Cancel
Save