Browse Source

Handle print completed LED event in M0

Scott Lahteine 4 years ago
parent
commit
bafe8d920a
3 changed files with 13 additions and 18 deletions
  1. 5
    15
      Marlin/src/MarlinCore.cpp
  2. 7
    2
      Marlin/src/gcode/lcd/M0_M1.cpp
  3. 1
    1
      Marlin/src/gcode/parser.h

+ 5
- 15
Marlin/src/MarlinCore.cpp View File

@@ -412,23 +412,13 @@ void startOrResumeJob() {
412 412
     #endif
413 413
   }
414 414
 
415
-  #if ENABLED(PRINTER_EVENT_LEDS)
416
-    #include "feature/leds/printer_event_leds.h"
417
-  #endif
418
-
419 415
   inline void finishSDPrinting() {
420 416
     bool did_state = true;
421 417
     switch (card.sdprinting_done_state) {
422 418
 
423
-      #if ENABLED(PRINTER_EVENT_LEDS)
424
-        case 1:
425
-          printerEventLEDs.onPrintCompleted();  // Change LED color for Print Completed
426
-          break;
427
-      #endif
428
-
429 419
       #if HAS_RESUME_CONTINUE                   // Display "Click to Continue..."
430
-        case 2:
431
-          did_state = queue.enqueue_P(PSTR("M0 S"
420
+        case 1:
421
+          did_state = queue.enqueue_P(PSTR("M0Q1S"
432 422
             #if HAS_LCD_MENU
433 423
               "1800"                            // ...for 30 minutes with LCD
434 424
             #else
@@ -438,13 +428,13 @@ void startOrResumeJob() {
438 428
           break;
439 429
       #endif
440 430
 
441
-      case 3: print_job_timer.stop(); break;
431
+      case 2: print_job_timer.stop(); break;
442 432
 
443
-      case 4:
433
+      case 3:
444 434
         did_state = print_job_timer.duration() < 60 || queue.enqueue_P(PSTR("M31"));
445 435
         break;
446 436
 
447
-      case 5:
437
+      case 4:
448 438
         #if ENABLED(POWER_LOSS_RECOVERY)
449 439
           recovery.purge();
450 440
         #endif

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

@@ -67,11 +67,16 @@ void GcodeSuite::M0_M1() {
67 67
 
68 68
   planner.synchronize();
69 69
 
70
+  #if HAS_LEDS_OFF_FLAG
71
+    if (parser.seen('Q'))
72
+      printerEventLEDs.onPrintCompleted();  // Change LED color for Print Completed
73
+  #endif
74
+
70 75
   #if HAS_LCD_MENU
71 76
 
72 77
     if (has_message)
73 78
       ui.set_status(args, true);
74
-    else if (!parser.seenval('Q')) {
79
+    else {
75 80
       LCD_MESSAGEPGM(MSG_USERWAIT);
76 81
       #if ENABLED(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0
77 82
         ui.reset_progress_bar_timeout();
@@ -98,7 +103,7 @@ void GcodeSuite::M0_M1() {
98 103
   wait_for_user = true;
99 104
 
100 105
   #if ENABLED(HOST_PROMPT_SUPPORT)
101
-    host_prompt_do(PROMPT_USER_CONTINUE, PSTR("M0/1 Break Called"), CONTINUE_STR);
106
+    host_prompt_do(PROMPT_USER_CONTINUE, parser.codenum ? PSTR("M1 Stop") : PSTR("M0 Stop"), CONTINUE_STR);
102 107
   #endif
103 108
 
104 109
   if (ms > 0) ms += millis();  // wait until this time for a click

+ 1
- 1
Marlin/src/gcode/parser.h View File

@@ -241,7 +241,7 @@ public:
241 241
   // Seen a parameter with a value
242 242
   static inline bool seenval(const char c) { return seen(c) && has_value(); }
243 243
 
244
-  // Float removes 'E' to prevent scientific notation interpretation
244
+  // The value as a string
245 245
   static inline char* value_string() { return value_ptr; }
246 246
 
247 247
   // Float removes 'E' to prevent scientific notation interpretation

Loading…
Cancel
Save