Browse Source

Fix M0/M1 message string

Scott Lahteine 4 years ago
parent
commit
6d18f715e4
1 changed files with 9 additions and 21 deletions
  1. 9
    21
      Marlin/src/gcode/lcd/M0_M1.cpp

+ 9
- 21
Marlin/src/gcode/lcd/M0_M1.cpp View File

50
  * M1: Conditional stop   - Wait for user button press on LCD
50
  * M1: Conditional stop   - Wait for user button press on LCD
51
  */
51
  */
52
 void GcodeSuite::M0_M1() {
52
 void GcodeSuite::M0_M1() {
53
-  const char * const args = parser.string_arg;
54
-
55
   millis_t ms = 0;
53
   millis_t ms = 0;
56
-  bool hasP = false, hasS = false;
57
-  if (parser.seenval('P')) {
58
-    ms = parser.value_millis(); // milliseconds to wait
59
-    hasP = ms > 0;
60
-  }
61
-  if (parser.seenval('S')) {
62
-    ms = parser.value_millis_from_seconds(); // seconds to wait
63
-    hasS = ms > 0;
64
-  }
65
-
66
-  const bool has_message = !hasP && !hasS && args && *args;
54
+  if (parser.seenval('P')) ms = parser.value_millis();              // Milliseconds to wait
55
+  if (parser.seenval('S')) ms = parser.value_millis_from_seconds(); // Seconds to wait
67
 
56
 
68
   planner.synchronize();
57
   planner.synchronize();
69
 
58
 
70
   #if HAS_LEDS_OFF_FLAG
59
   #if HAS_LEDS_OFF_FLAG
71
-    if (parser.seen('Q'))
72
-      printerEventLEDs.onPrintCompleted();  // Change LED color for Print Completed
60
+    if (parser.seen('Q')) printerEventLEDs.onPrintCompleted();      // Change LED color for Print Completed
73
   #endif
61
   #endif
74
 
62
 
75
   #if HAS_LCD_MENU
63
   #if HAS_LCD_MENU
76
 
64
 
77
-    if (has_message)
78
-      ui.set_status(args, true);
65
+    if (parser.string_arg)
66
+      ui.set_status(parser.string_arg, true);
79
     else {
67
     else {
80
       LCD_MESSAGEPGM(MSG_USERWAIT);
68
       LCD_MESSAGEPGM(MSG_USERWAIT);
81
       #if ENABLED(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0
69
       #if ENABLED(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0
85
 
73
 
86
   #elif ENABLED(EXTENSIBLE_UI)
74
   #elif ENABLED(EXTENSIBLE_UI)
87
 
75
 
88
-    if (has_message)
89
-      ExtUI::onUserConfirmRequired(args); // Can this take an SRAM string??
76
+    if (parser.string_arg)
77
+      ExtUI::onUserConfirmRequired(parser.string_arg); // Can this take an SRAM string??
90
     else
78
     else
91
       ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_USERWAIT));
79
       ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_USERWAIT));
92
 
80
 
93
   #else
81
   #else
94
 
82
 
95
-    if (has_message) {
83
+    if (parser.string_arg) {
96
       SERIAL_ECHO_START();
84
       SERIAL_ECHO_START();
97
-      SERIAL_ECHOLN(args);
85
+      SERIAL_ECHOLN(parser.string_arg);
98
     }
86
     }
99
 
87
 
100
   #endif
88
   #endif

Loading…
Cancel
Save