Browse Source

Case light G-code M355

implemented G-Code M355 into Marlin
Stanley 8 years ago
parent
commit
ab3f966f5f

+ 1
- 0
Marlin/Conditionals_post.h View File

509
   #define HAS_E4_STEP (PIN_EXISTS(E4_STEP))
509
   #define HAS_E4_STEP (PIN_EXISTS(E4_STEP))
510
   #define HAS_DIGIPOTSS (PIN_EXISTS(DIGIPOTSS))
510
   #define HAS_DIGIPOTSS (PIN_EXISTS(DIGIPOTSS))
511
   #define HAS_BUZZER (PIN_EXISTS(BEEPER) || ENABLED(LCD_USE_I2C_BUZZER))
511
   #define HAS_BUZZER (PIN_EXISTS(BEEPER) || ENABLED(LCD_USE_I2C_BUZZER))
512
+  #define HAS_CASE_LIGHT (PIN_EXISTS(CASE_LIGHT))
512
 
513
 
513
   #define HAS_MOTOR_CURRENT_PWM (PIN_EXISTS(MOTOR_CURRENT_PWM_XY) || PIN_EXISTS(MOTOR_CURRENT_PWM_Z) || PIN_EXISTS(MOTOR_CURRENT_PWM_E))
514
   #define HAS_MOTOR_CURRENT_PWM (PIN_EXISTS(MOTOR_CURRENT_PWM_XY) || PIN_EXISTS(MOTOR_CURRENT_PWM_Z) || PIN_EXISTS(MOTOR_CURRENT_PWM_E))
514
 
515
 

+ 4
- 0
Marlin/Configuration_adv.h View File

224
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
224
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
225
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
225
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
226
 
226
 
227
+// Define a pin to turn case light on/off
228
+//#define CASE_LIGHT_PIN 4
229
+//#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
230
+
227
 //===========================================================================
231
 //===========================================================================
228
 //============================ Mechanical Settings ==========================
232
 //============================ Mechanical Settings ==========================
229
 //===========================================================================
233
 //===========================================================================

+ 56
- 0
Marlin/Marlin_main.cpp View File

867
   #endif
867
   #endif
868
 }
868
 }
869
 
869
 
870
+#if HAS_CASE_LIGHT
871
+
872
+  void setup_case_light() {
873
+    #if ENABLED(CASE_LIGHT_DEFAULT_ON)
874
+      OUT_WRITE(CASE_LIGHT_PIN, HIGH);
875
+    #else
876
+      OUT_WRITE(CASE_LIGHT_PIN, LOW);
877
+    #endif
878
+  }
879
+
880
+#endif
881
+
870
 void setup_powerhold() {
882
 void setup_powerhold() {
871
   #if HAS_SUICIDE
883
   #if HAS_SUICIDE
872
     OUT_WRITE(SUICIDE_PIN, HIGH);
884
     OUT_WRITE(SUICIDE_PIN, HIGH);
7087
 
7099
 
7088
 #endif // HAS_MICROSTEPS
7100
 #endif // HAS_MICROSTEPS
7089
 
7101
 
7102
+#if HAS_CASE_LIGHT
7103
+  /**
7104
+   * M355: Turn case lights on/off
7105
+   *
7106
+   *   S<int>   change state on/off or sets PWM
7107
+   *
7108
+   */
7109
+  inline void gcode_M355() {
7110
+    if (code_seen('S')) {
7111
+      SERIAL_ECHO_START;
7112
+      SERIAL_ECHOPGM("Case lights ");
7113
+      byte light_pwm = code_value_byte();
7114
+      switch (light_pwm) {
7115
+        case 0: // Disable lights
7116
+          SERIAL_ECHOPGM("off");
7117
+          break;
7118
+        case 1: // Enable lights
7119
+          light_pwm = 255;
7120
+          SERIAL_ECHOPGM("on");
7121
+          break;
7122
+        default: // Enable lights PWM
7123
+          SERIAL_ECHOPAIR("set to: ", (int)map(light_pwm, 0, 255, 0, 100));
7124
+          SERIAL_CHAR('%');
7125
+          break;
7126
+      }
7127
+      analogWrite(CASE_LIGHT_PIN, light_pwm);
7128
+      SERIAL_EOL;
7129
+    }
7130
+  }
7131
+
7132
+#endif // HAS_CASE_LIGHT
7133
+
7090
 #if ENABLED(MIXING_EXTRUDER)
7134
 #if ENABLED(MIXING_EXTRUDER)
7091
 
7135
 
7092
   /**
7136
   /**
8195
 
8239
 
8196
       #endif // HAS_MICROSTEPS
8240
       #endif // HAS_MICROSTEPS
8197
 
8241
 
8242
+      #if HAS_CASE_LIGHT
8243
+
8244
+        case 355: // M355 Turn case lights on/off
8245
+          gcode_M355();
8246
+          break;
8247
+
8248
+      #endif // HAS_CASE_LIGHT
8249
+
8198
       case 999: // M999: Restart after being Stopped
8250
       case 999: // M999: Restart after being Stopped
8199
         gcode_M999();
8251
         gcode_M999();
8200
         break;
8252
         break;
9696
   setup_photpin();
9748
   setup_photpin();
9697
   servo_init();
9749
   servo_init();
9698
 
9750
 
9751
+  #if HAS_CASE_LIGHT
9752
+    setup_case_light();
9753
+  #endif
9754
+
9699
   #if HAS_BED_PROBE
9755
   #if HAS_BED_PROBE
9700
     endstops.enable_z_probe(false);
9756
     endstops.enable_z_probe(false);
9701
   #endif
9757
   #endif

+ 4
- 0
Marlin/example_configurations/Cartesio/Configuration_adv.h View File

224
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 35
224
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 35
225
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
225
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
226
 
226
 
227
+// Define a pin to turn case light on/off
228
+//#define CASE_LIGHT_PIN 4
229
+//#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
230
+
227
 //===========================================================================
231
 //===========================================================================
228
 //============================ Mechanical Settings ==========================
232
 //============================ Mechanical Settings ==========================
229
 //===========================================================================
233
 //===========================================================================

+ 4
- 0
Marlin/example_configurations/Felix/Configuration_adv.h View File

224
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
224
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
225
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
225
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
226
 
226
 
227
+// Define a pin to turn case light on/off
228
+//#define CASE_LIGHT_PIN 4
229
+//#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
230
+
227
 //===========================================================================
231
 //===========================================================================
228
 //============================ Mechanical Settings ==========================
232
 //============================ Mechanical Settings ==========================
229
 //===========================================================================
233
 //===========================================================================

+ 4
- 0
Marlin/example_configurations/Hephestos/Configuration_adv.h View File

224
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
224
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
225
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
225
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
226
 
226
 
227
+// Define a pin to turn case light on/off
228
+//#define CASE_LIGHT_PIN 4
229
+//#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
230
+
227
 //===========================================================================
231
 //===========================================================================
228
 //============================ Mechanical Settings ==========================
232
 //============================ Mechanical Settings ==========================
229
 //===========================================================================
233
 //===========================================================================

+ 4
- 0
Marlin/example_configurations/Hephestos_2/Configuration_adv.h View File

224
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
224
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
225
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
225
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
226
 
226
 
227
+// Define a pin to turn case light on/off
228
+//#define CASE_LIGHT_PIN 4
229
+//#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
230
+
227
 //===========================================================================
231
 //===========================================================================
228
 //============================ Mechanical Settings ==========================
232
 //============================ Mechanical Settings ==========================
229
 //===========================================================================
233
 //===========================================================================

+ 4
- 0
Marlin/example_configurations/K8200/Configuration_adv.h View File

230
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
230
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
231
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
231
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
232
 
232
 
233
+// Define a pin to turn case light on/off
234
+//#define CASE_LIGHT_PIN 4
235
+//#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
236
+
233
 //===========================================================================
237
 //===========================================================================
234
 //============================ Mechanical Settings ==========================
238
 //============================ Mechanical Settings ==========================
235
 //===========================================================================
239
 //===========================================================================

+ 4
- 0
Marlin/example_configurations/K8400/Configuration_adv.h View File

224
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
224
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
225
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
225
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
226
 
226
 
227
+// Define a pin to turn case light on/off
228
+//#define CASE_LIGHT_PIN 4
229
+//#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
230
+
227
 //===========================================================================
231
 //===========================================================================
228
 //============================ Mechanical Settings ==========================
232
 //============================ Mechanical Settings ==========================
229
 //===========================================================================
233
 //===========================================================================

+ 4
- 0
Marlin/example_configurations/RigidBot/Configuration_adv.h View File

224
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
224
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
225
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
225
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
226
 
226
 
227
+// Define a pin to turn case light on/off
228
+//#define CASE_LIGHT_PIN 4
229
+//#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
230
+
227
 //===========================================================================
231
 //===========================================================================
228
 //============================ Mechanical Settings ==========================
232
 //============================ Mechanical Settings ==========================
229
 //===========================================================================
233
 //===========================================================================

+ 4
- 0
Marlin/example_configurations/SCARA/Configuration_adv.h View File

224
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
224
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
225
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
225
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
226
 
226
 
227
+// Define a pin to turn case light on/off
228
+//#define CASE_LIGHT_PIN 4
229
+//#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
230
+
227
 //===========================================================================
231
 //===========================================================================
228
 //============================ Mechanical Settings ==========================
232
 //============================ Mechanical Settings ==========================
229
 //===========================================================================
233
 //===========================================================================

+ 4
- 0
Marlin/example_configurations/TAZ4/Configuration_adv.h View File

232
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
232
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
233
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
233
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
234
 
234
 
235
+// Define a pin to turn case light on/off
236
+//#define CASE_LIGHT_PIN 4
237
+//#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
238
+
235
 //===========================================================================
239
 //===========================================================================
236
 //============================ Mechanical Settings ==========================
240
 //============================ Mechanical Settings ==========================
237
 //===========================================================================
241
 //===========================================================================

+ 4
- 0
Marlin/example_configurations/WITBOX/Configuration_adv.h View File

224
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
224
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
225
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
225
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
226
 
226
 
227
+// Define a pin to turn case light on/off
228
+//#define CASE_LIGHT_PIN 4
229
+//#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
230
+
227
 //===========================================================================
231
 //===========================================================================
228
 //============================ Mechanical Settings ==========================
232
 //============================ Mechanical Settings ==========================
229
 //===========================================================================
233
 //===========================================================================

+ 4
- 0
Marlin/example_configurations/delta/biv2.5/Configuration_adv.h View File

224
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
224
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
225
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
225
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
226
 
226
 
227
+// Define a pin to turn case light on/off
228
+//#define CASE_LIGHT_PIN 4
229
+//#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
230
+
227
 //===========================================================================
231
 //===========================================================================
228
 //============================ Mechanical Settings ==========================
232
 //============================ Mechanical Settings ==========================
229
 //===========================================================================
233
 //===========================================================================

+ 4
- 0
Marlin/example_configurations/delta/generic/Configuration_adv.h View File

224
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
224
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
225
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
225
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
226
 
226
 
227
+// Define a pin to turn case light on/off
228
+//#define CASE_LIGHT_PIN 4
229
+//#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
230
+
227
 //===========================================================================
231
 //===========================================================================
228
 //============================ Mechanical Settings ==========================
232
 //============================ Mechanical Settings ==========================
229
 //===========================================================================
233
 //===========================================================================

+ 4
- 0
Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h View File

224
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
224
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
225
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
225
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
226
 
226
 
227
+// Define a pin to turn case light on/off
228
+//#define CASE_LIGHT_PIN 4
229
+//#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
230
+
227
 //===========================================================================
231
 //===========================================================================
228
 //============================ Mechanical Settings ==========================
232
 //============================ Mechanical Settings ==========================
229
 //===========================================================================
233
 //===========================================================================

+ 4
- 0
Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h View File

229
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
229
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
230
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
230
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
231
 
231
 
232
+// Define a pin to turn case light on/off
233
+//#define CASE_LIGHT_PIN 4
234
+//#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
235
+
232
 //===========================================================================
236
 //===========================================================================
233
 //============================ Mechanical Settings ==========================
237
 //============================ Mechanical Settings ==========================
234
 //===========================================================================
238
 //===========================================================================

+ 4
- 0
Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h View File

224
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
224
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
225
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
225
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
226
 
226
 
227
+// Define a pin to turn case light on/off
228
+//#define CASE_LIGHT_PIN 4
229
+//#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
230
+
227
 //===========================================================================
231
 //===========================================================================
228
 //============================ Mechanical Settings ==========================
232
 //============================ Mechanical Settings ==========================
229
 //===========================================================================
233
 //===========================================================================

+ 4
- 0
Marlin/example_configurations/makibox/Configuration_adv.h View File

224
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
224
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
225
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
225
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
226
 
226
 
227
+// Define a pin to turn case light on/off
228
+//#define CASE_LIGHT_PIN 4
229
+//#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
230
+
227
 //===========================================================================
231
 //===========================================================================
228
 //============================ Mechanical Settings ==========================
232
 //============================ Mechanical Settings ==========================
229
 //===========================================================================
233
 //===========================================================================

+ 4
- 0
Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h View File

224
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
224
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
225
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
225
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
226
 
226
 
227
+// Define a pin to turn case light on/off
228
+//#define CASE_LIGHT_PIN 4
229
+//#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
230
+
227
 //===========================================================================
231
 //===========================================================================
228
 //============================ Mechanical Settings ==========================
232
 //============================ Mechanical Settings ==========================
229
 //===========================================================================
233
 //===========================================================================

Loading…
Cancel
Save