Browse Source

Support for M335 case light "no case light"

Damien 7 years ago
parent
commit
4e2639942b
2 changed files with 19 additions and 17 deletions
  1. 18
    17
      Marlin/Marlin_main.cpp
  2. 1
    0
      Marlin/language.h

+ 18
- 17
Marlin/Marlin_main.cpp View File

@@ -7595,22 +7595,27 @@ inline void gcode_M907() {
7595 7595
     analogWrite(CASE_LIGHT_PIN, case_light_on != INVERT_CASE_LIGHT ? case_light_brightness : 0);
7596 7596
   }
7597 7597
 
7598
-  /**
7599
-   * M355: Turn case lights on/off and set brightness
7600
-   *
7601
-   *   S<bool>  Turn case light on or off
7602
-   *   P<byte>  Set case light brightness (PWM pin required)
7603
-   */
7604
-  inline void gcode_M355() {
7598
+#endif // HAS_CASE_LIGHT
7599
+
7600
+/**
7601
+ * M355: Turn case lights on/off and set brightness
7602
+ *
7603
+ *   S<bool>  Turn case light on or off
7604
+ *   P<byte>  Set case light brightness (PWM pin required)
7605
+ */
7606
+inline void gcode_M355() {
7607
+  #if HAS_CASE_LIGHT
7605 7608
     if (code_seen('P')) case_light_brightness = code_value_byte();
7606 7609
     if (code_seen('S')) case_light_on = code_value_bool();
7607 7610
     update_case_light();
7608 7611
     SERIAL_ECHO_START;
7609 7612
     SERIAL_ECHOPGM("Case lights ");
7610 7613
     case_light_on ? SERIAL_ECHOLNPGM("on") : SERIAL_ECHOLNPGM("off");
7611
-  }
7612
-
7613
-#endif // HAS_CASE_LIGHT
7614
+  #else
7615
+    SERIAL_ERROR_START;
7616
+    SERIAL_ERRORLNPGM(MSG_ERR_M355_NONE);
7617
+  #endif // HAS_CASE_LIGHT
7618
+}
7614 7619
 
7615 7620
 #if ENABLED(MIXING_EXTRUDER)
7616 7621
 
@@ -8751,13 +8756,9 @@ void process_next_command() {
8751 8756
 
8752 8757
       #endif // HAS_MICROSTEPS
8753 8758
 
8754
-      #if HAS_CASE_LIGHT
8755
-
8756
-        case 355: // M355 Turn case lights on/off
8757
-          gcode_M355();
8758
-          break;
8759
-
8760
-      #endif // HAS_CASE_LIGHT
8759
+      case 355: // M355 Turn case lights on/off
8760
+        gcode_M355();
8761
+        break;
8761 8762
 
8762 8763
       case 999: // M999: Restart after being Stopped
8763 8764
         gcode_M999();

+ 1
- 0
Marlin/language.h View File

@@ -153,6 +153,7 @@
153 153
 #define MSG_Z2_MAX                          "z2_max: "
154 154
 #define MSG_Z_PROBE                         "z_probe: "
155 155
 #define MSG_ERR_MATERIAL_INDEX              "M145 S<index> out of range (0-1)"
156
+#define MSG_ERR_M355_NONE                   "No case light"
156 157
 #define MSG_ERR_M421_PARAMETERS             "M421 required parameters missing"
157 158
 #define MSG_ERR_MESH_XY                     "Mesh point cannot be resolved"
158 159
 #define MSG_ERR_ARC_ARGS                    "G2/G3 bad parameters"

Loading…
Cancel
Save