Browse Source

Wait before turning off PRINTER_EVENT_LEDS at print end (#10248)

Scott Lahteine 7 years ago
parent
commit
9e4c037cef
No account linked to committer's email address
3 changed files with 27 additions and 4 deletions
  1. 4
    0
      Marlin/src/gcode/gcode.h
  2. 12
    0
      Marlin/src/gcode/lcd/M0_M1.cpp
  3. 11
    4
      Marlin/src/gcode/queue.cpp

+ 4
- 0
Marlin/src/gcode/gcode.h View File

@@ -324,6 +324,10 @@ public:
324 324
     #define KEEPALIVE_STATE(n) NOOP
325 325
   #endif
326 326
 
327
+  #if ENABLED(PRINTER_EVENT_LEDS) && ENABLED(SDSUPPORT) && HAS_RESUME_CONTINUE
328
+    static bool lights_off_after_print;
329
+  #endif
330
+
327 331
   static void dwell(millis_t time);
328 332
 
329 333
 private:

+ 12
- 0
Marlin/src/gcode/lcd/M0_M1.cpp View File

@@ -33,6 +33,11 @@
33 33
 
34 34
 #include "../../sd/cardreader.h"
35 35
 
36
+#if ENABLED(PRINTER_EVENT_LEDS) && ENABLED(SDSUPPORT)
37
+  bool GcodeSuite::lights_off_after_print;
38
+  #include "../../feature/leds/leds.h"
39
+#endif
40
+
36 41
 /**
37 42
  * M0: Unconditional stop - Wait for user button press on LCD
38 43
  * M1: Conditional stop   - Wait for user button press on LCD
@@ -91,6 +96,13 @@ void GcodeSuite::M0_M1() {
91 96
     #endif
92 97
   }
93 98
 
99
+  #if ENABLED(PRINTER_EVENT_LEDS) && ENABLED(SDSUPPORT)
100
+    if (lights_off_after_print) {
101
+      leds.set_off();
102
+      lights_off_after_print = false;
103
+    }
104
+  #endif
105
+
94 106
   wait_for_user = false;
95 107
   KEEPALIVE_STATE(IN_HANDLER);
96 108
 }

+ 11
- 4
Marlin/src/gcode/queue.cpp View File

@@ -449,12 +449,19 @@ inline void get_serial_commands() {
449 449
               LCD_MESSAGEPGM(MSG_INFO_COMPLETED_PRINTS);
450 450
               leds.set_green();
451 451
               #if HAS_RESUME_CONTINUE
452
-                enqueue_and_echo_commands_P(PSTR("M0")); // end of the queue!
452
+                gcode.lights_off_after_print = true;
453
+                enqueue_and_echo_commands_P(PSTR("M0 S"
454
+                  #if ENABLED(NEWPANEL)
455
+                    "1800"
456
+                  #else
457
+                    "60"
458
+                  #endif
459
+                ));
453 460
               #else
454
-                safe_delay(1000);
461
+                safe_delay(2000);
462
+                leds.set_off();
455 463
               #endif
456
-              leds.set_off();
457
-            #endif
464
+            #endif // PRINTER_EVENT_LEDS
458 465
             card.checkautostart(true);
459 466
           }
460 467
         }

Loading…
Cancel
Save