Browse Source

Save some progmem (#12913)

Giuliano Zaro 6 years ago
parent
commit
85f149befe

+ 0
- 1
Marlin/src/core/language.h View File

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

+ 15
- 19
Marlin/src/gcode/feature/caselight/M355.cpp View File

@@ -26,22 +26,20 @@
26 26
 
27 27
 #if HAS_CASE_LIGHT
28 28
   #include "../../../feature/caselight.h"
29
-#endif
30 29
 
31
-/**
32
- * M355: Turn case light on/off and set brightness
33
- *
34
- *   P<byte>  Set case light brightness (PWM pin required - ignored otherwise)
35
- *
36
- *   S<bool>  Set case light on/off
37
- *
38
- *   When S turns on the light on a PWM pin then the current brightness level is used/restored
39
- *
40
- *   M355 P200 S0 turns off the light & sets the brightness level
41
- *   M355 S1 turns on the light with a brightness of 200 (assuming a PWM pin)
42
- */
43
-void GcodeSuite::M355() {
44
-  #if HAS_CASE_LIGHT
30
+  /**
31
+   * M355: Turn case light on/off and set brightness
32
+   *
33
+   *   P<byte>  Set case light brightness (PWM pin required - ignored otherwise)
34
+   *
35
+   *   S<bool>  Set case light on/off
36
+   *
37
+   *   When S turns on the light on a PWM pin then the current brightness level is used/restored
38
+   *
39
+   *   M355 P200 S0 turns off the light & sets the brightness level
40
+   *   M355 S1 turns on the light with a brightness of 200 (assuming a PWM pin)
41
+   */
42
+  void GcodeSuite::M355() {
45 43
     uint8_t args = 0;
46 44
     if (parser.seenval('P')) {
47 45
       ++args, case_light_brightness = parser.value_byte();
@@ -62,7 +60,5 @@ void GcodeSuite::M355() {
62 60
       if (!USEABLE_HARDWARE_PWM(CASE_LIGHT_PIN)) SERIAL_ECHOLNPGM("Case light: on");
63 61
       else SERIAL_ECHOLNPAIR("Case light: ", case_light_brightness);
64 62
     }
65
-  #else
66
-    SERIAL_ERROR_MSG(MSG_ERR_M355_NONE);
67
-  #endif
68
-}
63
+  }
64
+#endif // HAS_CASE_LIGHT

+ 3
- 1
Marlin/src/gcode/gcode.cpp View File

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

+ 3
- 1
Marlin/src/gcode/gcode.h View File

@@ -672,7 +672,9 @@ private:
672 672
     static void M351();
673 673
   #endif
674 674
 
675
-  static void M355();
675
+  #if HAS_CASE_LIGHT
676
+    static void M355();
677
+  #endif
676 678
 
677 679
   #if ENABLED(MORGAN_SCARA)
678 680
     static bool M360();

Loading…
Cancel
Save