Browse Source

Save some progmem (#12913)

pull/1/head
Giuliano Zaro 6 years ago
committed by Scott Lahteine
parent
commit
85f149befe
  1. 1
      Marlin/src/core/language.h
  2. 34
      Marlin/src/gcode/feature/caselight/M355.cpp
  3. 4
      Marlin/src/gcode/gcode.cpp
  4. 4
      Marlin/src/gcode/gcode.h

1
Marlin/src/core/language.h

@ -197,7 +197,6 @@
#define MSG_SKEW_MIN "min_skew_factor: " #define MSG_SKEW_MIN "min_skew_factor: "
#define MSG_SKEW_MAX "max_skew_factor: " #define MSG_SKEW_MAX "max_skew_factor: "
#define MSG_ERR_MATERIAL_INDEX "M145 S<index> out of range (0-1)" #define MSG_ERR_MATERIAL_INDEX "M145 S<index> out of range (0-1)"
#define MSG_ERR_M355_NONE "No case light"
#define MSG_ERR_M421_PARAMETERS "M421 incorrect parameter usage" #define MSG_ERR_M421_PARAMETERS "M421 incorrect parameter usage"
#define MSG_ERR_BAD_PLANE_MODE "G5 requires XY plane mode" #define MSG_ERR_BAD_PLANE_MODE "G5 requires XY plane mode"
#define MSG_ERR_MESH_XY "Mesh point cannot be resolved" #define MSG_ERR_MESH_XY "Mesh point cannot be resolved"

34
Marlin/src/gcode/feature/caselight/M355.cpp

@ -26,22 +26,20 @@
#if HAS_CASE_LIGHT #if HAS_CASE_LIGHT
#include "../../../feature/caselight.h" #include "../../../feature/caselight.h"
#endif
/** /**
* M355: Turn case light on/off and set brightness * M355: Turn case light on/off and set brightness
* *
* P<byte> Set case light brightness (PWM pin required - ignored otherwise) * P<byte> Set case light brightness (PWM pin required - ignored otherwise)
* *
* S<bool> Set case light on/off * S<bool> Set case light on/off
* *
* When S turns on the light on a PWM pin then the current brightness level is used/restored * When S turns on the light on a PWM pin then the current brightness level is used/restored
* *
* M355 P200 S0 turns off the light & sets the brightness level * M355 P200 S0 turns off the light & sets the brightness level
* M355 S1 turns on the light with a brightness of 200 (assuming a PWM pin) * M355 S1 turns on the light with a brightness of 200 (assuming a PWM pin)
*/ */
void GcodeSuite::M355() { void GcodeSuite::M355() {
#if HAS_CASE_LIGHT
uint8_t args = 0; uint8_t args = 0;
if (parser.seenval('P')) { if (parser.seenval('P')) {
++args, case_light_brightness = parser.value_byte(); ++args, case_light_brightness = parser.value_byte();
@ -62,7 +60,5 @@ void GcodeSuite::M355() {
if (!USEABLE_HARDWARE_PWM(CASE_LIGHT_PIN)) SERIAL_ECHOLNPGM("Case light: on"); if (!USEABLE_HARDWARE_PWM(CASE_LIGHT_PIN)) SERIAL_ECHOLNPGM("Case light: on");
else SERIAL_ECHOLNPAIR("Case light: ", case_light_brightness); else SERIAL_ECHOLNPAIR("Case light: ", case_light_brightness);
} }
#else }
SERIAL_ERROR_MSG(MSG_ERR_M355_NONE); #endif // HAS_CASE_LIGHT
#endif
}

4
Marlin/src/gcode/gcode.cpp

@ -669,7 +669,9 @@ void GcodeSuite::process_parsed_command(
case 351: M351(); break; // M351: Toggle MS1 MS2 pins directly, S# determines MS1 or MS2, X# sets the pin high/low. case 351: M351(); break; // M351: Toggle MS1 MS2 pins directly, S# determines MS1 or MS2, X# sets the pin high/low.
#endif #endif
case 355: M355(); break; // M355: Set case light brightness #if HAS_CASE_LIGHT
case 355: M355(); break; // M355: Set case light brightness
#endif
#if ENABLED(DEBUG_GCODE_PARSER) #if ENABLED(DEBUG_GCODE_PARSER)
case 800: parser.debug(); break; // M800: GCode Parser Test for M case 800: parser.debug(); break; // M800: GCode Parser Test for M

4
Marlin/src/gcode/gcode.h

@ -672,7 +672,9 @@ private:
static void M351(); static void M351();
#endif #endif
static void M355(); #if HAS_CASE_LIGHT
static void M355();
#endif
#if ENABLED(MORGAN_SCARA) #if ENABLED(MORGAN_SCARA)
static bool M360(); static bool M360();

Loading…
Cancel
Save