Refactor PRINTER_EVENT_LEDS, apply to M303 (#12038)

Co-Authored-By: Giuliano Zaro <gmagician@users.noreply.github.com>
This commit is contained in:
Giuliano Zaro
2018-10-11 04:25:43 +02:00
committed by Scott Lahteine
parent d8d76cd2ba
commit d43d4e4219
13 changed files with 205 additions and 73 deletions

View File

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

View File

@ -33,9 +33,8 @@
#include "../../sd/cardreader.h"
#if ENABLED(PRINTER_EVENT_LEDS) && ENABLED(SDSUPPORT)
bool GcodeSuite::lights_off_after_print;
#include "../../feature/leds/leds.h"
#if HAS_LEDS_OFF_FLAG
#include "../../feature/leds/printer_event_leds.h"
#endif
/**
@ -90,11 +89,8 @@ void GcodeSuite::M0_M1() {
else
while (wait_for_user) idle();
#if ENABLED(PRINTER_EVENT_LEDS) && ENABLED(SDSUPPORT)
if (lights_off_after_print) {
leds.set_off();
lights_off_after_print = false;
}
#if HAS_LEDS_OFF_FLAG
printerEventLEDs.onResumeAfterWait();
#endif
#if ENABLED(ULTIPANEL)

View File

@ -33,8 +33,8 @@
#include "../module/temperature.h"
#include "../Marlin.h"
#if HAS_COLOR_LEDS
#include "../feature/leds/leds.h"
#if ENABLED(PRINTER_EVENT_LEDS)
#include "../feature/leds/printer_event_leds.h"
#endif
#if ENABLED(POWER_LOSS_RECOVERY)
@ -484,10 +484,8 @@ inline void get_serial_commands() {
else {
SERIAL_PROTOCOLLNPGM(MSG_FILE_PRINTED);
#if ENABLED(PRINTER_EVENT_LEDS)
LCD_MESSAGEPGM(MSG_INFO_COMPLETED_PRINTS);
leds.set_green();
printerEventLEDs.onPrintCompleted();
#if HAS_RESUME_CONTINUE
gcode.lights_off_after_print = true;
enqueue_and_echo_commands_P(PSTR("M0 S"
#if ENABLED(NEWPANEL)
"1800"
@ -495,9 +493,6 @@ inline void get_serial_commands() {
"60"
#endif
));
#else
safe_delay(2000);
leds.set_off();
#endif
#endif // PRINTER_EVENT_LEDS
}

View File

@ -31,10 +31,6 @@
#include "../../module/printcounter.h"
#endif
#if ENABLED(PRINTER_EVENT_LEDS)
#include "../../feature/leds/leds.h"
#endif
#if ENABLED(SINGLENOZZLE)
#include "../../module/tool_change.h"
#endif