From 4e2639942b258881f2a0872f53f544f5de4cac4f Mon Sep 17 00:00:00 2001 From: Damien Date: Mon, 19 Dec 2016 15:41:02 +1100 Subject: [PATCH] Support for M335 case light "no case light" --- Marlin/Marlin_main.cpp | 35 ++++++++++++++++++----------------- Marlin/language.h | 1 + 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 033f121ed..e9bf5b10e 100755 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -7595,22 +7595,27 @@ inline void gcode_M907() { analogWrite(CASE_LIGHT_PIN, case_light_on != INVERT_CASE_LIGHT ? case_light_brightness : 0); } - /** - * M355: Turn case lights on/off and set brightness - * - * S Turn case light on or off - * P Set case light brightness (PWM pin required) - */ - inline void gcode_M355() { +#endif // HAS_CASE_LIGHT + +/** + * M355: Turn case lights on/off and set brightness + * + * S Turn case light on or off + * P Set case light brightness (PWM pin required) + */ +inline void gcode_M355() { + #if HAS_CASE_LIGHT if (code_seen('P')) case_light_brightness = code_value_byte(); if (code_seen('S')) case_light_on = code_value_bool(); update_case_light(); SERIAL_ECHO_START; SERIAL_ECHOPGM("Case lights "); case_light_on ? SERIAL_ECHOLNPGM("on") : SERIAL_ECHOLNPGM("off"); - } - -#endif // HAS_CASE_LIGHT + #else + SERIAL_ERROR_START; + SERIAL_ERRORLNPGM(MSG_ERR_M355_NONE); + #endif // HAS_CASE_LIGHT +} #if ENABLED(MIXING_EXTRUDER) @@ -8751,13 +8756,9 @@ void process_next_command() { #endif // HAS_MICROSTEPS - #if HAS_CASE_LIGHT - - case 355: // M355 Turn case lights on/off - gcode_M355(); - break; - - #endif // HAS_CASE_LIGHT + case 355: // M355 Turn case lights on/off + gcode_M355(); + break; case 999: // M999: Restart after being Stopped gcode_M999(); diff --git a/Marlin/language.h b/Marlin/language.h index 27bfaed64..544bdeea5 100644 --- a/Marlin/language.h +++ b/Marlin/language.h @@ -153,6 +153,7 @@ #define MSG_Z2_MAX "z2_max: " #define MSG_Z_PROBE "z_probe: " #define MSG_ERR_MATERIAL_INDEX "M145 S out of range (0-1)" +#define MSG_ERR_M355_NONE "No case light" #define MSG_ERR_M421_PARAMETERS "M421 required parameters missing" #define MSG_ERR_MESH_XY "Mesh point cannot be resolved" #define MSG_ERR_ARC_ARGS "G2/G3 bad parameters"