Kaynağa Gözat

Fix M0/M1 message string

Scott Lahteine 4 yıl önce
ebeveyn
işleme
6d18f715e4
1 değiştirilmiş dosya ile 9 ekleme ve 21 silme
  1. 9
    21
      Marlin/src/gcode/lcd/M0_M1.cpp

+ 9
- 21
Marlin/src/gcode/lcd/M0_M1.cpp Dosyayı Görüntüle

@@ -50,32 +50,20 @@
50 50
  * M1: Conditional stop   - Wait for user button press on LCD
51 51
  */
52 52
 void GcodeSuite::M0_M1() {
53
-  const char * const args = parser.string_arg;
54
-
55 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 57
   planner.synchronize();
69 58
 
70 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 61
   #endif
74 62
 
75 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 67
     else {
80 68
       LCD_MESSAGEPGM(MSG_USERWAIT);
81 69
       #if ENABLED(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0
@@ -85,16 +73,16 @@ void GcodeSuite::M0_M1() {
85 73
 
86 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 78
     else
91 79
       ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_USERWAIT));
92 80
 
93 81
   #else
94 82
 
95
-    if (has_message) {
83
+    if (parser.string_arg) {
96 84
       SERIAL_ECHO_START();
97
-      SERIAL_ECHOLN(args);
85
+      SERIAL_ECHOLN(parser.string_arg);
98 86
     }
99 87
 
100 88
   #endif

Loading…
İptal
Kaydet