1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-27 13:56:24 +00:00

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

This commit is contained in:
Scott Lahteine 2018-03-28 22:59:28 -05:00 committed by GitHub
parent 568ae094f4
commit 9e4c037cef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 4 deletions

View File

@ -324,6 +324,10 @@ public:
#define KEEPALIVE_STATE(n) NOOP #define KEEPALIVE_STATE(n) NOOP
#endif #endif
#if ENABLED(PRINTER_EVENT_LEDS) && ENABLED(SDSUPPORT) && HAS_RESUME_CONTINUE
static bool lights_off_after_print;
#endif
static void dwell(millis_t time); static void dwell(millis_t time);
private: private:

View File

@ -33,6 +33,11 @@
#include "../../sd/cardreader.h" #include "../../sd/cardreader.h"
#if ENABLED(PRINTER_EVENT_LEDS) && ENABLED(SDSUPPORT)
bool GcodeSuite::lights_off_after_print;
#include "../../feature/leds/leds.h"
#endif
/** /**
* M0: Unconditional stop - Wait for user button press on LCD * M0: Unconditional stop - Wait for user button press on LCD
* M1: Conditional stop - Wait for user button press on LCD * M1: Conditional stop - Wait for user button press on LCD
@ -91,6 +96,13 @@ void GcodeSuite::M0_M1() {
#endif #endif
} }
#if ENABLED(PRINTER_EVENT_LEDS) && ENABLED(SDSUPPORT)
if (lights_off_after_print) {
leds.set_off();
lights_off_after_print = false;
}
#endif
wait_for_user = false; wait_for_user = false;
KEEPALIVE_STATE(IN_HANDLER); KEEPALIVE_STATE(IN_HANDLER);
} }

View File

@ -449,12 +449,19 @@ inline void get_serial_commands() {
LCD_MESSAGEPGM(MSG_INFO_COMPLETED_PRINTS); LCD_MESSAGEPGM(MSG_INFO_COMPLETED_PRINTS);
leds.set_green(); leds.set_green();
#if HAS_RESUME_CONTINUE #if HAS_RESUME_CONTINUE
enqueue_and_echo_commands_P(PSTR("M0")); // end of the queue! gcode.lights_off_after_print = true;
enqueue_and_echo_commands_P(PSTR("M0 S"
#if ENABLED(NEWPANEL)
"1800"
#else #else
safe_delay(1000); "60"
#endif #endif
));
#else
safe_delay(2000);
leds.set_off(); leds.set_off();
#endif #endif
#endif // PRINTER_EVENT_LEDS
card.checkautostart(true); card.checkautostart(true);
} }
} }