Browse Source

copied file changes from PR #5685

==============================

Configuration_adv.h changes

==============================

add "live" LCD update

==============================

P & S version

==============================

final (hopefully) tested version

==============================

update M115 capabilities print

==============================

Menu changes portion of the requested changes

==============================

changed USEABLE_HARDWARE_PWM from a function to a series of macros

==============================

changes per review
Bob-the-Kuhn 7 years ago
parent
commit
9657e7d3ee
28 changed files with 473 additions and 201 deletions
  1. 13
    7
      Marlin/Configuration_adv.h
  2. 52
    28
      Marlin/Marlin_main.cpp
  3. 13
    7
      Marlin/example_configurations/Cartesio/Configuration_adv.h
  4. 13
    7
      Marlin/example_configurations/Felix/Configuration_adv.h
  5. 13
    7
      Marlin/example_configurations/FolgerTech-i3-2020/Configuration_adv.h
  6. 13
    7
      Marlin/example_configurations/Hephestos/Configuration_adv.h
  7. 13
    7
      Marlin/example_configurations/Hephestos_2/Configuration_adv.h
  8. 13
    7
      Marlin/example_configurations/K8200/Configuration_adv.h
  9. 13
    7
      Marlin/example_configurations/K8400/Configuration_adv.h
  10. 13
    7
      Marlin/example_configurations/RigidBot/Configuration_adv.h
  11. 13
    7
      Marlin/example_configurations/SCARA/Configuration_adv.h
  12. 13
    7
      Marlin/example_configurations/TAZ4/Configuration_adv.h
  13. 13
    7
      Marlin/example_configurations/TinyBoy2/Configuration_adv.h
  14. 13
    7
      Marlin/example_configurations/WITBOX/Configuration_adv.h
  15. 13
    7
      Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration_adv.h
  16. 13
    7
      Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration_adv.h
  17. 13
    7
      Marlin/example_configurations/delta/generic/Configuration_adv.h
  18. 13
    7
      Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h
  19. 13
    7
      Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h
  20. 13
    7
      Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h
  21. 13
    7
      Marlin/example_configurations/gCreate_gMax1.5+/Configuration_adv.h
  22. 13
    7
      Marlin/example_configurations/makibox/Configuration_adv.h
  23. 13
    7
      Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h
  24. 13
    7
      Marlin/example_configurations/wt150/Configuration_adv.h
  25. 91
    1
      Marlin/fastio.h
  26. 3
    1
      Marlin/language_en.h
  27. 27
    9
      Marlin/ultralcd.cpp
  28. 1
    1
      Marlin/ultralcd.h

+ 13
- 7
Marlin/Configuration_adv.h View File

@@ -220,13 +220,19 @@
220 220
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
221 221
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
222 222
 
223
-// Define a pin to turn case light on/off
224
-//#define CASE_LIGHT_PIN 4
225
-#if PIN_EXISTS(CASE_LIGHT)
226
-  #define INVERT_CASE_LIGHT false   // Set to true if HIGH is the OFF state (active low)
227
-  //#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
228
-  //#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
229
-#endif
223
+// M355 Case Light command 
224
+//   Set case light brightness/on/off
225
+
226
+//#define CASE_LIGHT_ENABLE 
227
+#if ENABLED(CASE_LIGHT_ENABLE) 
228
+  #define CASE_LIGHT_PIN 4          // can be defined here or in the pins_XXX.h file for your board 
229
+                                    //  pins_XXX.h file overrides this one 
230
+  #define INVERT_CASE_LIGHT false             // set to true if case light is ON when pin is at 0 
231
+  #define CASE_LIGHT_DEFAULT_ON true          // set default power up state to on or off
232
+  #define CASE_LIGHT_DEFAULT_BRIGHTNESS 105   // set power up brightness 0-255 ( only used if on PWM
233
+                                              // and if CASE_LIGHT_DEFAULT is set to on
234
+  //#define MENU_ITEM_CASE_LIGHT              // Uncomment to have a Case Light entry in main menu 
235
+#endif 
230 236
 
231 237
 //===========================================================================
232 238
 //============================ Mechanical Settings ==========================

+ 52
- 28
Marlin/Marlin_main.cpp View File

@@ -176,7 +176,7 @@
176 176
  * M304 - Set bed PID parameters P I and D. (Requires PIDTEMPBED)
177 177
  * M350 - Set microstepping mode. (Requires digital microstepping pins.)
178 178
  * M351 - Toggle MS1 MS2 pins directly. (Requires digital microstepping pins.)
179
- * M355 - Turn the Case Light on/off and set its brightness. (Requires CASE_LIGHT_PIN)
179
+ * M355 - Set Case Light on/off and set brightness. (Requires CASE_LIGHT_PIN)
180 180
  * M380 - Activate solenoid on active extruder. (Requires EXT_SOLENOID)
181 181
  * M381 - Disable all solenoids. (Requires EXT_SOLENOID)
182 182
  * M400 - Finish all moves.
@@ -566,16 +566,6 @@ static uint8_t target_extruder;
566 566
   ;
567 567
 #endif
568 568
 
569
-#if HAS_CASE_LIGHT
570
-  bool case_light_on =
571
-    #if ENABLED(CASE_LIGHT_DEFAULT_ON)
572
-      true
573
-    #else
574
-      false
575
-    #endif
576
-  ;
577
-#endif
578
-
579 569
 #if ENABLED(DELTA)
580 570
 
581 571
   float delta[ABC],
@@ -720,7 +710,8 @@ static void report_current_position();
720 710
     SERIAL_ECHOPAIR(", ", z);
721 711
     SERIAL_CHAR(')');
722 712
 
723
-    suffix ? serialprintPGM(suffix) : SERIAL_EOL;
713
+    if (suffix) {serialprintPGM(suffix);}  //won't compile for Teensy with the previous construction
714
+    else SERIAL_EOL;
724 715
   }
725 716
 
726 717
   void print_xyz(const char* prefix, const char* suffix, const float xyz[]) {
@@ -5263,7 +5254,7 @@ void home_all_axes() { gcode_G28(true); }
5263 5254
 
5264 5255
           recalc_delta_settings(delta_radius, delta_diagonal_rod);
5265 5256
         }
5266
-        else if(zero_std_dev >= test_precision) {   // step one back
5257
+        else if (zero_std_dev >= test_precision) {   // step one back
5267 5258
           COPY(endstop_adj, e_old);
5268 5259
           delta_radius = dr_old;
5269 5260
           home_offset[Z_AXIS] = zh_old;
@@ -7678,11 +7669,18 @@ inline void gcode_M115() {
7678 7669
       SERIAL_PROTOCOLLNPGM("Cap:SOFTWARE_POWER:0");
7679 7670
     #endif
7680 7671
 
7681
-    // TOGGLE_LIGHTS (M355)
7672
+    // CASE LIGHTS (M355)
7682 7673
     #if HAS_CASE_LIGHT
7683 7674
       SERIAL_PROTOCOLLNPGM("Cap:TOGGLE_LIGHTS:1");
7675
+      bool USEABLE_HARDWARE_PWM(uint8_t pin);
7676
+      if (USEABLE_HARDWARE_PWM(CASE_LIGHT_PIN)) {
7677
+        SERIAL_PROTOCOLLNPGM("Cap:CASE_LIGHT_BRIGHTNESS:1");
7678
+      }
7679
+      else
7680
+        SERIAL_PROTOCOLLNPGM("Cap:CASE_LIGHT_BRIGHTNESS:0");
7684 7681
     #else
7685 7682
       SERIAL_PROTOCOLLNPGM("Cap:TOGGLE_LIGHTS:0");
7683
+      SERIAL_PROTOCOLLNPGM("Cap:CASE_LIGHT_BRIGHTNESS:0");
7686 7684
     #endif
7687 7685
 
7688 7686
     // EMERGENCY_PARSER (M108, M112, M410)
@@ -9472,30 +9470,54 @@ inline void gcode_M907() {
9472 9470
 #endif // HAS_MICROSTEPS
9473 9471
 
9474 9472
 #if HAS_CASE_LIGHT
9475
-
9476
-  uint8_t case_light_brightness = 255;
9473
+  #ifndef INVERT_CASE_LIGHT
9474
+    #define INVERT_CASE_LIGHT false
9475
+  #endif
9476
+  int case_light_brightness;  // LCD routine wants INT
9477
+  bool case_light_on;
9477 9478
 
9478 9479
   void update_case_light() {
9479
-    WRITE(CASE_LIGHT_PIN, case_light_on != INVERT_CASE_LIGHT ? HIGH : LOW);
9480
-    analogWrite(CASE_LIGHT_PIN, case_light_on != INVERT_CASE_LIGHT ? case_light_brightness : 0);
9480
+    pinMode(CASE_LIGHT_PIN, OUTPUT); // digitalWrite doesn't set the port mode
9481
+    uint8_t case_light_bright = (uint8_t)case_light_brightness;
9482
+    if (case_light_on) {
9483
+      if (USEABLE_HARDWARE_PWM(CASE_LIGHT_PIN)) {
9484
+        analogWrite(CASE_LIGHT_PIN, INVERT_CASE_LIGHT ? 255 - case_light_brightness : case_light_brightness );
9485
+      }
9486
+      else digitalWrite(CASE_LIGHT_PIN, INVERT_CASE_LIGHT ? LOW : HIGH );
9487
+    }
9488
+    else digitalWrite(CASE_LIGHT_PIN, INVERT_CASE_LIGHT ? HIGH : LOW);
9481 9489
   }
9482
-
9483 9490
 #endif // HAS_CASE_LIGHT
9484 9491
 
9485 9492
 /**
9486
- * M355: Turn case lights on/off and set brightness
9493
+ * M355: Turn case light on/off and set brightness
9494
+ *
9495
+ *   P<byte>  Set case light brightness (PWM pin required - ignored otherwise)
9496
+ *
9497
+ *   S<bool>  Set case light on/off
9498
+ *
9499
+ *   When S turns on the light on a PWM pin then the current brightness level is used/restored
9487 9500
  *
9488
- *   S<bool>  Turn case light on or off
9489
- *   P<byte>  Set case light brightness (PWM pin required)
9501
+ *   M355 P200 S0 turns off the light & sets the brightness level
9502
+ *   M355 S1 turns on the light with a brightness of 200 (assuming a PWM pin)
9490 9503
  */
9491 9504
 inline void gcode_M355() {
9492 9505
   #if HAS_CASE_LIGHT
9493
-    if (parser.seen('P')) case_light_brightness = parser.value_byte();
9494
-    if (parser.seen('S')) case_light_on = parser.value_bool();
9495
-    update_case_light();
9506
+    uint8_t args = 0;
9507
+    if (parser.seen('P')) ++args, case_light_brightness = parser.value_byte();
9508
+    if (parser.seen('S')) ++args, case_light_on = parser.value_bool(); 
9509
+    if (args) update_case_light();
9510
+
9511
+    // always report case light status
9496 9512
     SERIAL_ECHO_START;
9497
-    SERIAL_ECHOPGM("Case lights ");
9498
-    case_light_on ? SERIAL_ECHOLNPGM("on") : SERIAL_ECHOLNPGM("off");
9513
+    if (!case_light_on) {
9514
+      SERIAL_ECHOLN("Case light: off");
9515
+    }
9516
+    else {
9517
+      if (!USEABLE_HARDWARE_PWM(CASE_LIGHT_PIN)) SERIAL_ECHOLN("Case light: on");
9518
+      else SERIAL_ECHOLNPAIR("Case light: ", case_light_brightness);
9519
+    }
9520
+
9499 9521
   #else
9500 9522
     SERIAL_ERROR_START;
9501 9523
     SERIAL_ERRORLNPGM(MSG_ERR_M355_NONE);
@@ -10710,7 +10732,7 @@ void process_next_command() {
10710 10732
 
10711 10733
       #endif // HAS_MICROSTEPS
10712 10734
 
10713
-      case 355: // M355 Turn case lights on/off
10735
+      case 355: // M355 set case light brightness
10714 10736
         gcode_M355();
10715 10737
         break;
10716 10738
 
@@ -12459,6 +12481,8 @@ void setup() {
12459 12481
   #endif
12460 12482
 
12461 12483
   #if HAS_CASE_LIGHT
12484
+    case_light_on = CASE_LIGHT_DEFAULT_ON;
12485
+    case_light_brightness = CASE_LIGHT_DEFAULT_BRIGHTNESS;
12462 12486
     update_case_light();
12463 12487
   #endif
12464 12488
 

+ 13
- 7
Marlin/example_configurations/Cartesio/Configuration_adv.h View File

@@ -220,13 +220,19 @@
220 220
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 35
221 221
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
222 222
 
223
-// Define a pin to turn case light on/off
224
-//#define CASE_LIGHT_PIN 4
225
-#if PIN_EXISTS(CASE_LIGHT)
226
-  #define INVERT_CASE_LIGHT false   // Set to true if HIGH is the OFF state (active low)
227
-  //#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
228
-  //#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
229
-#endif
223
+// M355 Case Light command 
224
+//   Set case light brightness/on/off
225
+
226
+//#define CASE_LIGHT_ENABLE 
227
+#if ENABLED(CASE_LIGHT_ENABLE) 
228
+  #define CASE_LIGHT_PIN 4          // can be defined here or in the pins_XXX.h file for your board 
229
+                                    //  pins_XXX.h file overrides this one 
230
+  #define INVERT_CASE_LIGHT false             // set to true if case light is ON when pin is at 0 
231
+  #define CASE_LIGHT_DEFAULT_ON true          // set default power up state to on or off
232
+  #define CASE_LIGHT_DEFAULT_BRIGHTNESS 105   // set power up brightness 0-255 ( only used if on PWM
233
+                                              // and if CASE_LIGHT_DEFAULT is set to on
234
+  //#define MENU_ITEM_CASE_LIGHT              // Uncomment to have a Case Light entry in main menu 
235
+#endif 
230 236
 
231 237
 //===========================================================================
232 238
 //============================ Mechanical Settings ==========================

+ 13
- 7
Marlin/example_configurations/Felix/Configuration_adv.h View File

@@ -220,13 +220,19 @@
220 220
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
221 221
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
222 222
 
223
-// Define a pin to turn case light on/off
224
-//#define CASE_LIGHT_PIN 4
225
-#if PIN_EXISTS(CASE_LIGHT)
226
-  #define INVERT_CASE_LIGHT false   // Set to true if HIGH is the OFF state (active low)
227
-  //#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
228
-  //#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
229
-#endif
223
+// M355 Case Light command 
224
+//   Set case light brightness/on/off
225
+
226
+//#define CASE_LIGHT_ENABLE 
227
+#if ENABLED(CASE_LIGHT_ENABLE) 
228
+  #define CASE_LIGHT_PIN 4          // can be defined here or in the pins_XXX.h file for your board 
229
+                                    //  pins_XXX.h file overrides this one 
230
+  #define INVERT_CASE_LIGHT false             // set to true if case light is ON when pin is at 0 
231
+  #define CASE_LIGHT_DEFAULT_ON true          // set default power up state to on or off
232
+  #define CASE_LIGHT_DEFAULT_BRIGHTNESS 105   // set power up brightness 0-255 ( only used if on PWM
233
+                                              // and if CASE_LIGHT_DEFAULT is set to on
234
+  //#define MENU_ITEM_CASE_LIGHT              // Uncomment to have a Case Light entry in main menu 
235
+#endif 
230 236
 
231 237
 //===========================================================================
232 238
 //============================ Mechanical Settings ==========================

+ 13
- 7
Marlin/example_configurations/FolgerTech-i3-2020/Configuration_adv.h View File

@@ -220,13 +220,19 @@
220 220
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
221 221
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
222 222
 
223
-// Define a pin to turn case light on/off
224
-//#define CASE_LIGHT_PIN 4
225
-#if PIN_EXISTS(CASE_LIGHT)
226
-  #define INVERT_CASE_LIGHT false   // Set to true if HIGH is the OFF state (active low)
227
-  //#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
228
-  //#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
229
-#endif
223
+// M355 Case Light command 
224
+//   Set case light brightness/on/off
225
+
226
+//#define CASE_LIGHT_ENABLE 
227
+#if ENABLED(CASE_LIGHT_ENABLE) 
228
+  #define CASE_LIGHT_PIN 4          // can be defined here or in the pins_XXX.h file for your board 
229
+                                    //  pins_XXX.h file overrides this one 
230
+  #define INVERT_CASE_LIGHT false             // set to true if case light is ON when pin is at 0 
231
+  #define CASE_LIGHT_DEFAULT_ON true          // set default power up state to on or off
232
+  #define CASE_LIGHT_DEFAULT_BRIGHTNESS 105   // set power up brightness 0-255 ( only used if on PWM
233
+                                              // and if CASE_LIGHT_DEFAULT is set to on
234
+  //#define MENU_ITEM_CASE_LIGHT              // Uncomment to have a Case Light entry in main menu 
235
+#endif 
230 236
 
231 237
 //===========================================================================
232 238
 //============================ Mechanical Settings ==========================

+ 13
- 7
Marlin/example_configurations/Hephestos/Configuration_adv.h View File

@@ -220,13 +220,19 @@
220 220
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
221 221
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
222 222
 
223
-// Define a pin to turn case light on/off
224
-//#define CASE_LIGHT_PIN 4
225
-#if PIN_EXISTS(CASE_LIGHT)
226
-  #define INVERT_CASE_LIGHT false   // Set to true if HIGH is the OFF state (active low)
227
-  //#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
228
-  //#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
229
-#endif
223
+// M355 Case Light command 
224
+//   Set case light brightness/on/off
225
+
226
+//#define CASE_LIGHT_ENABLE 
227
+#if ENABLED(CASE_LIGHT_ENABLE) 
228
+  #define CASE_LIGHT_PIN 4          // can be defined here or in the pins_XXX.h file for your board 
229
+                                    //  pins_XXX.h file overrides this one 
230
+  #define INVERT_CASE_LIGHT false             // set to true if case light is ON when pin is at 0 
231
+  #define CASE_LIGHT_DEFAULT_ON true          // set default power up state to on or off
232
+  #define CASE_LIGHT_DEFAULT_BRIGHTNESS 105   // set power up brightness 0-255 ( only used if on PWM
233
+                                              // and if CASE_LIGHT_DEFAULT is set to on
234
+  //#define MENU_ITEM_CASE_LIGHT              // Uncomment to have a Case Light entry in main menu 
235
+#endif 
230 236
 
231 237
 //===========================================================================
232 238
 //============================ Mechanical Settings ==========================

+ 13
- 7
Marlin/example_configurations/Hephestos_2/Configuration_adv.h View File

@@ -220,13 +220,19 @@
220 220
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
221 221
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
222 222
 
223
-// Define a pin to turn case light on/off
224
-//#define CASE_LIGHT_PIN 4
225
-#if PIN_EXISTS(CASE_LIGHT)
226
-  #define INVERT_CASE_LIGHT false   // Set to true if HIGH is the OFF state (active low)
227
-  //#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
228
-  //#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
229
-#endif
223
+// M355 Case Light command 
224
+//   Set case light brightness/on/off
225
+
226
+//#define CASE_LIGHT_ENABLE 
227
+#if ENABLED(CASE_LIGHT_ENABLE) 
228
+  #define CASE_LIGHT_PIN 4          // can be defined here or in the pins_XXX.h file for your board 
229
+                                    //  pins_XXX.h file overrides this one 
230
+  #define INVERT_CASE_LIGHT false             // set to true if case light is ON when pin is at 0 
231
+  #define CASE_LIGHT_DEFAULT_ON true          // set default power up state to on or off
232
+  #define CASE_LIGHT_DEFAULT_BRIGHTNESS 105   // set power up brightness 0-255 ( only used if on PWM
233
+                                              // and if CASE_LIGHT_DEFAULT is set to on
234
+  //#define MENU_ITEM_CASE_LIGHT              // Uncomment to have a Case Light entry in main menu 
235
+#endif 
230 236
 
231 237
 //===========================================================================
232 238
 //============================ Mechanical Settings ==========================

+ 13
- 7
Marlin/example_configurations/K8200/Configuration_adv.h View File

@@ -233,13 +233,19 @@
233 233
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
234 234
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
235 235
 
236
-// Define a pin to turn case light on/off
237
-//#define CASE_LIGHT_PIN 4
238
-#if PIN_EXISTS(CASE_LIGHT)
239
-  #define INVERT_CASE_LIGHT false   // Set to true if HIGH is the OFF state (active low)
240
-  //#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
241
-  //#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
242
-#endif
236
+// M355 Case Light command 
237
+//   Set case light brightness/on/off
238
+
239
+//#define CASE_LIGHT_ENABLE 
240
+#if ENABLED(CASE_LIGHT_ENABLE) 
241
+  #define CASE_LIGHT_PIN 4          // can be defined here or in the pins_XXX.h file for your board 
242
+                                    //  pins_XXX.h file overrides this one 
243
+  #define INVERT_CASE_LIGHT false             // set to true if case light is ON when pin is at 0 
244
+  #define CASE_LIGHT_DEFAULT_ON true          // set default power up state to on or off
245
+  #define CASE_LIGHT_DEFAULT_BRIGHTNESS 105   // set power up brightness 0-255 ( only used if on PWM
246
+                                              // and if CASE_LIGHT_DEFAULT is set to on
247
+  //#define MENU_ITEM_CASE_LIGHT              // Uncomment to have a Case Light entry in main menu 
248
+#endif 
243 249
 
244 250
 //===========================================================================
245 251
 //============================ Mechanical Settings ==========================

+ 13
- 7
Marlin/example_configurations/K8400/Configuration_adv.h View File

@@ -220,13 +220,19 @@
220 220
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
221 221
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
222 222
 
223
-// Define a pin to turn case light on/off
224
-//#define CASE_LIGHT_PIN 4
225
-#if PIN_EXISTS(CASE_LIGHT)
226
-  #define INVERT_CASE_LIGHT false   // Set to true if HIGH is the OFF state (active low)
227
-  //#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
228
-  //#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
229
-#endif
223
+// M355 Case Light command 
224
+//   Set case light brightness/on/off
225
+
226
+//#define CASE_LIGHT_ENABLE 
227
+#if ENABLED(CASE_LIGHT_ENABLE) 
228
+  #define CASE_LIGHT_PIN 4          // can be defined here or in the pins_XXX.h file for your board 
229
+                                    //  pins_XXX.h file overrides this one 
230
+  #define INVERT_CASE_LIGHT false             // set to true if case light is ON when pin is at 0 
231
+  #define CASE_LIGHT_DEFAULT_ON true          // set default power up state to on or off
232
+  #define CASE_LIGHT_DEFAULT_BRIGHTNESS 105   // set power up brightness 0-255 ( only used if on PWM
233
+                                              // and if CASE_LIGHT_DEFAULT is set to on
234
+  //#define MENU_ITEM_CASE_LIGHT              // Uncomment to have a Case Light entry in main menu 
235
+#endif 
230 236
 
231 237
 //===========================================================================
232 238
 //============================ Mechanical Settings ==========================

+ 13
- 7
Marlin/example_configurations/RigidBot/Configuration_adv.h View File

@@ -220,13 +220,19 @@
220 220
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
221 221
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
222 222
 
223
-// Define a pin to turn case light on/off
224
-//#define CASE_LIGHT_PIN 4
225
-#if PIN_EXISTS(CASE_LIGHT)
226
-  #define INVERT_CASE_LIGHT false   // Set to true if HIGH is the OFF state (active low)
227
-  //#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
228
-  //#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
229
-#endif
223
+// M355 Case Light command 
224
+//   Set case light brightness/on/off
225
+
226
+//#define CASE_LIGHT_ENABLE 
227
+#if ENABLED(CASE_LIGHT_ENABLE) 
228
+  #define CASE_LIGHT_PIN 4          // can be defined here or in the pins_XXX.h file for your board 
229
+                                    //  pins_XXX.h file overrides this one 
230
+  #define INVERT_CASE_LIGHT false             // set to true if case light is ON when pin is at 0 
231
+  #define CASE_LIGHT_DEFAULT_ON true          // set default power up state to on or off
232
+  #define CASE_LIGHT_DEFAULT_BRIGHTNESS 105   // set power up brightness 0-255 ( only used if on PWM
233
+                                              // and if CASE_LIGHT_DEFAULT is set to on
234
+  //#define MENU_ITEM_CASE_LIGHT              // Uncomment to have a Case Light entry in main menu 
235
+#endif 
230 236
 
231 237
 //===========================================================================
232 238
 //============================ Mechanical Settings ==========================

+ 13
- 7
Marlin/example_configurations/SCARA/Configuration_adv.h View File

@@ -220,13 +220,19 @@
220 220
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
221 221
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
222 222
 
223
-// Define a pin to turn case light on/off
224
-//#define CASE_LIGHT_PIN 4
225
-#if PIN_EXISTS(CASE_LIGHT)
226
-  #define INVERT_CASE_LIGHT false   // Set to true if HIGH is the OFF state (active low)
227
-  //#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
228
-  //#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
229
-#endif
223
+// M355 Case Light command 
224
+//   Set case light brightness/on/off
225
+
226
+//#define CASE_LIGHT_ENABLE 
227
+#if ENABLED(CASE_LIGHT_ENABLE) 
228
+  #define CASE_LIGHT_PIN 4          // can be defined here or in the pins_XXX.h file for your board 
229
+                                    //  pins_XXX.h file overrides this one 
230
+  #define INVERT_CASE_LIGHT false             // set to true if case light is ON when pin is at 0 
231
+  #define CASE_LIGHT_DEFAULT_ON true          // set default power up state to on or off
232
+  #define CASE_LIGHT_DEFAULT_BRIGHTNESS 105   // set power up brightness 0-255 ( only used if on PWM
233
+                                              // and if CASE_LIGHT_DEFAULT is set to on
234
+  //#define MENU_ITEM_CASE_LIGHT              // Uncomment to have a Case Light entry in main menu 
235
+#endif 
230 236
 
231 237
 //===========================================================================
232 238
 //============================ Mechanical Settings ==========================

+ 13
- 7
Marlin/example_configurations/TAZ4/Configuration_adv.h View File

@@ -220,13 +220,19 @@
220 220
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
221 221
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
222 222
 
223
-// Define a pin to turn case light on/off
224
-//#define CASE_LIGHT_PIN 4
225
-#if PIN_EXISTS(CASE_LIGHT)
226
-  #define INVERT_CASE_LIGHT false   // Set to true if HIGH is the OFF state (active low)
227
-  //#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
228
-  //#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
229
-#endif
223
+// M355 Case Light command 
224
+//   Set case light brightness/on/off
225
+
226
+//#define CASE_LIGHT_ENABLE 
227
+#if ENABLED(CASE_LIGHT_ENABLE) 
228
+  #define CASE_LIGHT_PIN 4          // can be defined here or in the pins_XXX.h file for your board 
229
+                                    //  pins_XXX.h file overrides this one 
230
+  #define INVERT_CASE_LIGHT false             // set to true if case light is ON when pin is at 0 
231
+  #define CASE_LIGHT_DEFAULT_ON true          // set default power up state to on or off
232
+  #define CASE_LIGHT_DEFAULT_BRIGHTNESS 105   // set power up brightness 0-255 ( only used if on PWM
233
+                                              // and if CASE_LIGHT_DEFAULT is set to on
234
+  //#define MENU_ITEM_CASE_LIGHT              // Uncomment to have a Case Light entry in main menu 
235
+#endif 
230 236
 
231 237
 //===========================================================================
232 238
 //============================ Mechanical Settings ==========================

+ 13
- 7
Marlin/example_configurations/TinyBoy2/Configuration_adv.h View File

@@ -220,13 +220,19 @@
220 220
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
221 221
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
222 222
 
223
-// Define a pin to turn case light on/off
224
-//#define CASE_LIGHT_PIN 4
225
-#if PIN_EXISTS(CASE_LIGHT)
226
-  #define INVERT_CASE_LIGHT false   // Set to true if HIGH is the OFF state (active low)
227
-  //#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
228
-  //#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
229
-#endif
223
+// M355 Case Light command 
224
+//   Set case light brightness/on/off
225
+
226
+//#define CASE_LIGHT_ENABLE 
227
+#if ENABLED(CASE_LIGHT_ENABLE) 
228
+  #define CASE_LIGHT_PIN 4          // can be defined here or in the pins_XXX.h file for your board 
229
+                                    //  pins_XXX.h file overrides this one 
230
+  #define INVERT_CASE_LIGHT false             // set to true if case light is ON when pin is at 0 
231
+  #define CASE_LIGHT_DEFAULT_ON true          // set default power up state to on or off
232
+  #define CASE_LIGHT_DEFAULT_BRIGHTNESS 105   // set power up brightness 0-255 ( only used if on PWM
233
+                                              // and if CASE_LIGHT_DEFAULT is set to on
234
+  //#define MENU_ITEM_CASE_LIGHT              // Uncomment to have a Case Light entry in main menu 
235
+#endif 
230 236
 
231 237
 //===========================================================================
232 238
 //============================ Mechanical Settings ==========================

+ 13
- 7
Marlin/example_configurations/WITBOX/Configuration_adv.h View File

@@ -220,13 +220,19 @@
220 220
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
221 221
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
222 222
 
223
-// Define a pin to turn case light on/off
224
-//#define CASE_LIGHT_PIN 4
225
-#if PIN_EXISTS(CASE_LIGHT)
226
-  #define INVERT_CASE_LIGHT false   // Set to true if HIGH is the OFF state (active low)
227
-  //#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
228
-  //#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
229
-#endif
223
+// M355 Case Light command 
224
+//   Set case light brightness/on/off
225
+
226
+//#define CASE_LIGHT_ENABLE 
227
+#if ENABLED(CASE_LIGHT_ENABLE) 
228
+  #define CASE_LIGHT_PIN 4          // can be defined here or in the pins_XXX.h file for your board 
229
+                                    //  pins_XXX.h file overrides this one 
230
+  #define INVERT_CASE_LIGHT false             // set to true if case light is ON when pin is at 0 
231
+  #define CASE_LIGHT_DEFAULT_ON true          // set default power up state to on or off
232
+  #define CASE_LIGHT_DEFAULT_BRIGHTNESS 105   // set power up brightness 0-255 ( only used if on PWM
233
+                                              // and if CASE_LIGHT_DEFAULT is set to on
234
+  //#define MENU_ITEM_CASE_LIGHT              // Uncomment to have a Case Light entry in main menu 
235
+#endif 
230 236
 
231 237
 //===========================================================================
232 238
 //============================ Mechanical Settings ==========================

+ 13
- 7
Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration_adv.h View File

@@ -220,13 +220,19 @@
220 220
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
221 221
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
222 222
 
223
-// Define a pin to turn case light on/off
224
-//#define CASE_LIGHT_PIN 4
225
-#if PIN_EXISTS(CASE_LIGHT)
226
-  #define INVERT_CASE_LIGHT false   // Set to true if HIGH is the OFF state (active low)
227
-  //#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
228
-  //#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
229
-#endif
223
+// M355 Case Light command 
224
+//   Set case light brightness/on/off
225
+
226
+//#define CASE_LIGHT_ENABLE 
227
+#if ENABLED(CASE_LIGHT_ENABLE) 
228
+  #define CASE_LIGHT_PIN 4          // can be defined here or in the pins_XXX.h file for your board 
229
+                                    //  pins_XXX.h file overrides this one 
230
+  #define INVERT_CASE_LIGHT false             // set to true if case light is ON when pin is at 0 
231
+  #define CASE_LIGHT_DEFAULT_ON true          // set default power up state to on or off
232
+  #define CASE_LIGHT_DEFAULT_BRIGHTNESS 105   // set power up brightness 0-255 ( only used if on PWM
233
+                                              // and if CASE_LIGHT_DEFAULT is set to on
234
+  //#define MENU_ITEM_CASE_LIGHT              // Uncomment to have a Case Light entry in main menu 
235
+#endif 
230 236
 
231 237
 //===========================================================================
232 238
 //============================ Mechanical Settings ==========================

+ 13
- 7
Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration_adv.h View File

@@ -220,13 +220,19 @@
220 220
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
221 221
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
222 222
 
223
-// Define a pin to turn case light on/off
224
-//#define CASE_LIGHT_PIN 4
225
-#if PIN_EXISTS(CASE_LIGHT)
226
-  #define INVERT_CASE_LIGHT false   // Set to true if HIGH is the OFF state (active low)
227
-  //#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
228
-  //#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
229
-#endif
223
+// M355 Case Light command 
224
+//   Set case light brightness/on/off
225
+
226
+//#define CASE_LIGHT_ENABLE 
227
+#if ENABLED(CASE_LIGHT_ENABLE) 
228
+  #define CASE_LIGHT_PIN 4          // can be defined here or in the pins_XXX.h file for your board 
229
+                                    //  pins_XXX.h file overrides this one 
230
+  #define INVERT_CASE_LIGHT false             // set to true if case light is ON when pin is at 0 
231
+  #define CASE_LIGHT_DEFAULT_ON true          // set default power up state to on or off
232
+  #define CASE_LIGHT_DEFAULT_BRIGHTNESS 105   // set power up brightness 0-255 ( only used if on PWM
233
+                                              // and if CASE_LIGHT_DEFAULT is set to on
234
+  //#define MENU_ITEM_CASE_LIGHT              // Uncomment to have a Case Light entry in main menu 
235
+#endif 
230 236
 
231 237
 //===========================================================================
232 238
 //============================ Mechanical Settings ==========================

+ 13
- 7
Marlin/example_configurations/delta/generic/Configuration_adv.h View File

@@ -220,13 +220,19 @@
220 220
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
221 221
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
222 222
 
223
-// Define a pin to turn case light on/off
224
-//#define CASE_LIGHT_PIN 4
225
-#if PIN_EXISTS(CASE_LIGHT)
226
-  #define INVERT_CASE_LIGHT false   // Set to true if HIGH is the OFF state (active low)
227
-  //#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
228
-  //#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
229
-#endif
223
+// M355 Case Light command 
224
+//   Set case light brightness/on/off
225
+
226
+//#define CASE_LIGHT_ENABLE 
227
+#if ENABLED(CASE_LIGHT_ENABLE) 
228
+  #define CASE_LIGHT_PIN 4          // can be defined here or in the pins_XXX.h file for your board 
229
+                                    //  pins_XXX.h file overrides this one 
230
+  #define INVERT_CASE_LIGHT false             // set to true if case light is ON when pin is at 0 
231
+  #define CASE_LIGHT_DEFAULT_ON true          // set default power up state to on or off
232
+  #define CASE_LIGHT_DEFAULT_BRIGHTNESS 105   // set power up brightness 0-255 ( only used if on PWM
233
+                                              // and if CASE_LIGHT_DEFAULT is set to on
234
+  //#define MENU_ITEM_CASE_LIGHT              // Uncomment to have a Case Light entry in main menu 
235
+#endif 
230 236
 
231 237
 //===========================================================================
232 238
 //============================ Mechanical Settings ==========================

+ 13
- 7
Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h View File

@@ -220,13 +220,19 @@
220 220
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
221 221
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
222 222
 
223
-// Define a pin to turn case light on/off
224
-//#define CASE_LIGHT_PIN 4
225
-#if PIN_EXISTS(CASE_LIGHT)
226
-  #define INVERT_CASE_LIGHT false   // Set to true if HIGH is the OFF state (active low)
227
-  //#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
228
-  //#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
229
-#endif
223
+// M355 Case Light command 
224
+//   Set case light brightness/on/off
225
+
226
+//#define CASE_LIGHT_ENABLE 
227
+#if ENABLED(CASE_LIGHT_ENABLE) 
228
+  #define CASE_LIGHT_PIN 4          // can be defined here or in the pins_XXX.h file for your board 
229
+                                    //  pins_XXX.h file overrides this one 
230
+  #define INVERT_CASE_LIGHT false             // set to true if case light is ON when pin is at 0 
231
+  #define CASE_LIGHT_DEFAULT_ON true          // set default power up state to on or off
232
+  #define CASE_LIGHT_DEFAULT_BRIGHTNESS 105   // set power up brightness 0-255 ( only used if on PWM
233
+                                              // and if CASE_LIGHT_DEFAULT is set to on
234
+  //#define MENU_ITEM_CASE_LIGHT              // Uncomment to have a Case Light entry in main menu 
235
+#endif 
230 236
 
231 237
 //===========================================================================
232 238
 //============================ Mechanical Settings ==========================

+ 13
- 7
Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h View File

@@ -225,13 +225,19 @@
225 225
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
226 226
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
227 227
 
228
-// Define a pin to turn case light on/off
229
-//#define CASE_LIGHT_PIN 4
230
-#if PIN_EXISTS(CASE_LIGHT)
231
-  #define INVERT_CASE_LIGHT false   // Set to true if HIGH is the OFF state (active low)
232
-  //#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
233
-  //#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
234
-#endif
228
+// M355 Case Light command 
229
+//   Set case light brightness/on/off
230
+
231
+//#define CASE_LIGHT_ENABLE 
232
+#if ENABLED(CASE_LIGHT_ENABLE) 
233
+  #define CASE_LIGHT_PIN 4          // can be defined here or in the pins_XXX.h file for your board 
234
+                                    //  pins_XXX.h file overrides this one 
235
+  #define INVERT_CASE_LIGHT false             // set to true if case light is ON when pin is at 0 
236
+  #define CASE_LIGHT_DEFAULT_ON true          // set default power up state to on or off
237
+  #define CASE_LIGHT_DEFAULT_BRIGHTNESS 105   // set power up brightness 0-255 ( only used if on PWM
238
+                                              // and if CASE_LIGHT_DEFAULT is set to on
239
+  //#define MENU_ITEM_CASE_LIGHT              // Uncomment to have a Case Light entry in main menu 
240
+#endif 
235 241
 
236 242
 //===========================================================================
237 243
 //============================ Mechanical Settings ==========================

+ 13
- 7
Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h View File

@@ -220,13 +220,19 @@
220 220
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
221 221
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
222 222
 
223
-// Define a pin to turn case light on/off
224
-//#define CASE_LIGHT_PIN 4
225
-#if PIN_EXISTS(CASE_LIGHT)
226
-  #define INVERT_CASE_LIGHT false   // Set to true if HIGH is the OFF state (active low)
227
-  //#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
228
-  //#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
229
-#endif
223
+// M355 Case Light command 
224
+//   Set case light brightness/on/off
225
+
226
+//#define CASE_LIGHT_ENABLE 
227
+#if ENABLED(CASE_LIGHT_ENABLE) 
228
+  #define CASE_LIGHT_PIN 4          // can be defined here or in the pins_XXX.h file for your board 
229
+                                    //  pins_XXX.h file overrides this one 
230
+  #define INVERT_CASE_LIGHT false             // set to true if case light is ON when pin is at 0 
231
+  #define CASE_LIGHT_DEFAULT_ON true          // set default power up state to on or off
232
+  #define CASE_LIGHT_DEFAULT_BRIGHTNESS 105   // set power up brightness 0-255 ( only used if on PWM
233
+                                              // and if CASE_LIGHT_DEFAULT is set to on
234
+  //#define MENU_ITEM_CASE_LIGHT              // Uncomment to have a Case Light entry in main menu 
235
+#endif 
230 236
 
231 237
 //===========================================================================
232 238
 //============================ Mechanical Settings ==========================

+ 13
- 7
Marlin/example_configurations/gCreate_gMax1.5+/Configuration_adv.h View File

@@ -220,13 +220,19 @@
220 220
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
221 221
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
222 222
 
223
-// Define a pin to turn case light on/off
224
-//#define CASE_LIGHT_PIN 4
225
-#if PIN_EXISTS(CASE_LIGHT)
226
-  #define INVERT_CASE_LIGHT false   // Set to true if HIGH is the OFF state (active low)
227
-  //#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
228
-  //#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
229
-#endif
223
+// M355 Case Light command 
224
+//   Set case light brightness/on/off
225
+
226
+//#define CASE_LIGHT_ENABLE 
227
+#if ENABLED(CASE_LIGHT_ENABLE) 
228
+  #define CASE_LIGHT_PIN 4          // can be defined here or in the pins_XXX.h file for your board 
229
+                                    //  pins_XXX.h file overrides this one 
230
+  #define INVERT_CASE_LIGHT false             // set to true if case light is ON when pin is at 0 
231
+  #define CASE_LIGHT_DEFAULT_ON true          // set default power up state to on or off
232
+  #define CASE_LIGHT_DEFAULT_BRIGHTNESS 105   // set power up brightness 0-255 ( only used if on PWM
233
+                                              // and if CASE_LIGHT_DEFAULT is set to on
234
+  //#define MENU_ITEM_CASE_LIGHT              // Uncomment to have a Case Light entry in main menu 
235
+#endif 
230 236
 
231 237
 //===========================================================================
232 238
 //============================ Mechanical Settings ==========================

+ 13
- 7
Marlin/example_configurations/makibox/Configuration_adv.h View File

@@ -220,13 +220,19 @@
220 220
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
221 221
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
222 222
 
223
-// Define a pin to turn case light on/off
224
-//#define CASE_LIGHT_PIN 4
225
-#if PIN_EXISTS(CASE_LIGHT)
226
-  #define INVERT_CASE_LIGHT false   // Set to true if HIGH is the OFF state (active low)
227
-  //#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
228
-  //#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
229
-#endif
223
+// M355 Case Light command 
224
+//   Set case light brightness/on/off
225
+
226
+//#define CASE_LIGHT_ENABLE 
227
+#if ENABLED(CASE_LIGHT_ENABLE) 
228
+  #define CASE_LIGHT_PIN 4          // can be defined here or in the pins_XXX.h file for your board 
229
+                                    //  pins_XXX.h file overrides this one 
230
+  #define INVERT_CASE_LIGHT false             // set to true if case light is ON when pin is at 0 
231
+  #define CASE_LIGHT_DEFAULT_ON true          // set default power up state to on or off
232
+  #define CASE_LIGHT_DEFAULT_BRIGHTNESS 105   // set power up brightness 0-255 ( only used if on PWM
233
+                                              // and if CASE_LIGHT_DEFAULT is set to on
234
+  //#define MENU_ITEM_CASE_LIGHT              // Uncomment to have a Case Light entry in main menu 
235
+#endif 
230 236
 
231 237
 //===========================================================================
232 238
 //============================ Mechanical Settings ==========================

+ 13
- 7
Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h View File

@@ -220,13 +220,19 @@
220 220
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
221 221
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
222 222
 
223
-// Define a pin to turn case light on/off
224
-//#define CASE_LIGHT_PIN 4
225
-#if PIN_EXISTS(CASE_LIGHT)
226
-  #define INVERT_CASE_LIGHT false   // Set to true if HIGH is the OFF state (active low)
227
-  //#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
228
-  //#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
229
-#endif
223
+// M355 Case Light command 
224
+//   Set case light brightness/on/off
225
+
226
+//#define CASE_LIGHT_ENABLE 
227
+#if ENABLED(CASE_LIGHT_ENABLE) 
228
+  #define CASE_LIGHT_PIN 4          // can be defined here or in the pins_XXX.h file for your board 
229
+                                    //  pins_XXX.h file overrides this one 
230
+  #define INVERT_CASE_LIGHT false             // set to true if case light is ON when pin is at 0 
231
+  #define CASE_LIGHT_DEFAULT_ON true          // set default power up state to on or off
232
+  #define CASE_LIGHT_DEFAULT_BRIGHTNESS 105   // set power up brightness 0-255 ( only used if on PWM
233
+                                              // and if CASE_LIGHT_DEFAULT is set to on
234
+  //#define MENU_ITEM_CASE_LIGHT              // Uncomment to have a Case Light entry in main menu 
235
+#endif 
230 236
 
231 237
 //===========================================================================
232 238
 //============================ Mechanical Settings ==========================

+ 13
- 7
Marlin/example_configurations/wt150/Configuration_adv.h View File

@@ -220,13 +220,19 @@
220 220
 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
221 221
 #define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
222 222
 
223
-// Define a pin to turn case light on/off
224
-//#define CASE_LIGHT_PIN 4
225
-#if PIN_EXISTS(CASE_LIGHT)
226
-  #define INVERT_CASE_LIGHT false   // Set to true if HIGH is the OFF state (active low)
227
-  //#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
228
-  //#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
229
-#endif
223
+// M355 Case Light command 
224
+//   Set case light brightness/on/off
225
+
226
+//#define CASE_LIGHT_ENABLE 
227
+#if ENABLED(CASE_LIGHT_ENABLE) 
228
+  #define CASE_LIGHT_PIN 4          // can be defined here or in the pins_XXX.h file for your board 
229
+                                    //  pins_XXX.h file overrides this one 
230
+  #define INVERT_CASE_LIGHT false             // set to true if case light is ON when pin is at 0 
231
+  #define CASE_LIGHT_DEFAULT_ON true          // set default power up state to on or off
232
+  #define CASE_LIGHT_DEFAULT_BRIGHTNESS 105   // set power up brightness 0-255 ( only used if on PWM
233
+                                              // and if CASE_LIGHT_DEFAULT is set to on
234
+  //#define MENU_ITEM_CASE_LIGHT              // Uncomment to have a Case Light entry in main menu 
235
+#endif 
230 236
 
231 237
 //===========================================================================
232 238
 //============================ Mechanical Settings ==========================

+ 91
- 1
Marlin/fastio.h View File

@@ -26,10 +26,11 @@
26 26
  * Contributed by Triffid_Hunter. Modified by Kliment and the Marlin team.
27 27
  */
28 28
 
29
-#ifndef _FASTIO_ARDUINO_H 
29
+#ifndef _FASTIO_ARDUINO_H
30 30
 #define _FASTIO_ARDUINO_H
31 31
 
32 32
 #include <avr/io.h>
33
+#include "macros.h"
33 34
 
34 35
 /**
35 36
  * Enable this option to use Teensy++ 2.0 assignments for AT90USB processors.
@@ -238,4 +239,93 @@ typedef enum {
238 239
 #define SET_FOCB(T,V) SET_FOC(T,B,V)
239 240
 #define SET_FOCC(T,V) SET_FOC(T,C,V)
240 241
 
242
+
243
+/**
244
+ * PWM availability macros
245
+ */
246
+#define AVR_AT90USB1286_FAMILY (defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1286P__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB646P__)  || defined(__AVR_AT90USB647__))
247
+#define AVR_ATmega1284_FAMILY (defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644PA__) || defined(__AVR_ATmega1284P__))
248
+#define AVR_ATmega2560_FAMILY (defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__))
249
+#define AVR_ATmega2561_FAMILY (defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__))
250
+#define AVR_ATmega328_FAMILY (defined(__AVR_ATmega168__) || defined(__AVR_ATmega328__) || defined(__AVR_ATmega328p__))
251
+
252
+//find out which harware PWMs are already in use
253
+#if PIN_EXISTS(CONTROLLER_FAN)
254
+  #define PWM_CHK_FAN_B(p) (p == CONTROLLER_FAN_PIN || p == E0_AUTO_FAN_PIN || p ==  E1_AUTO_FAN_PIN || p ==  E2_AUTO_FAN_PIN || p ==  E3_AUTO_FAN_PIN || p ==  E4_AUTO_FAN_PIN)
255
+#else
256
+  #define PWM_CHK_FAN_B(p) (p == E0_AUTO_FAN_PIN || p ==  E1_AUTO_FAN_PIN || p ==  E2_AUTO_FAN_PIN || p ==  E3_AUTO_FAN_PIN || p ==  E4_AUTO_FAN_PIN)
257
+#endif
258
+
259
+#if PIN_EXISTS(FAN) || PIN_EXISTS(FAN1) || PIN_EXISTS(FAN2)
260
+  #if PIN_EXISTS(FAN2)
261
+    #define PWM_CHK_FAN_A(p) (p == FAN_PIN || p == FAN1_PIN || p == FAN2_PIN)
262
+  #elif PIN_EXISTS(FAN1)
263
+    #define PWM_CHK_FAN_A(p) (p == FAN_PIN || p == FAN1_PIN)
264
+  #else
265
+    #define PWM_CHK_FAN_A(p) p == FAN_PIN
266
+  #endif
267
+#else
268
+  #define PWM_CHK_FAN_A(p) false
269
+#endif
270
+
271
+#if HAS_MOTOR_CURRENT_PWM
272
+  #if PIN_EXISTS(MOTOR_CURRENT_PWM_XY)
273
+    #define PWM_CHK_MOTOR_CURRENT(p) (p == MOTOR_CURRENT_PWM_E || p == MOTOR_CURRENT_PWM_Z || p == MOTOR_CURRENT_PWM_XY)
274
+  #elif PIN_EXISTS(MOTOR_CURRENT_PWM_Z)
275
+    #define PWM_CHK_MOTOR_CURRENT(p) (p == MOTOR_CURRENT_PWM_E || p == MOTOR_CURRENT_PWM_Z)
276
+  #else
277
+    #define PWM_CHK_MOTOR_CURRENT(p) (p == MOTOR_CURRENT_PWM_E)
278
+  #endif
279
+#else
280
+  #define PWM_CHK_MOTOR_CURRENT(p) false
281
+#endif
282
+
283
+#if defined(NUM_SERVOS)
284
+  #if AVR_ATmega2560_FAMILY
285
+    #define PWM_CHK_SERVO(p) ( p == 5 || NUM_SERVOS > 12 && p == 6 || NUM_SERVOS > 24 && p == 46)  //PWMS 3A, 4A & 5A
286
+  #elif AVR_ATmega2561_FAMILY
287
+    #define PWM_CHK_SERVO(p)   p ==  5  //PWM3A
288
+  #elif AVR_ATmega1284_FAMILY
289
+    #define PWM_CHK_SERVO(p)   false
290
+  #elif AVR_AT90USB1286_FAMILY
291
+    #define PWM_CHK_SERVO(p)   p ==  16 //PWM3A
292
+  #elif AVR_ATmega328_FAMILY
293
+    #define PWM_CHK_SERVO(p)   false
294
+  #endif
295
+#else
296
+  #define PWM_CHK_SERVO(p) false
297
+#endif
298
+
299
+#if ENABLED(BARICUDA)
300
+  #if HAS_HEATER_1 && HAS_HEATER_2
301
+    #define PWM_CHK_HEATER(p) (p == HEATER_1_PIN || p == HEATER_2_PIN)
302
+  #elif HAS_HEATER_1
303
+    #define PWM_CHK_HEATER(p) (p == HEATER_1_PIN)
304
+  #endif
305
+#else
306
+    #define PWM_CHK_HEATER(p) false
307
+#endif
308
+
309
+#define PWM_CHK(p) (PWM_CHK_HEATER(p) || PWM_CHK_SERVO(p)  || PWM_CHK_MOTOR_CURRENT(p)\
310
+                     || PWM_CHK_FAN_A(p) || PWM_CHK_FAN_B(p))
311
+
312
+// define which hardware PWMs are available for the current CPU
313
+// all timer 1 PWMS deleted from this list because they are never available
314
+#if AVR_ATmega2560_FAMILY
315
+  #define PWM_PINS(p)  ((p >= 2 && p <= 10 ) || p ==  13 || p ==  44 || p ==  45 || p ==  46 )
316
+#elif AVR_ATmega2561_FAMILY
317
+  #define PWM_PINS(p)  ((p >= 2 && p <= 6 ) || p ==  9)
318
+#elif AVR_ATmega1284_FAMILY
319
+  #define PWM_PINS(p)  (p == 3 || p ==  4 || p ==  14 || p ==  15)
320
+#elif AVR_AT90USB1286_FAMILY
321
+  #define PWM_PINS(p)  (p == 0 || p ==  1 || p ==  14 || p ==  15 || p ==  16 || p ==  24)
322
+#elif AVR_ATmega328_FAMILY
323
+  #define PWM_PINS(p)  (p == 3 || p ==  5 || p ==  6 || p ==  11)
324
+#else
325
+  #error "unknown CPU"
326
+#endif
327
+
328
+// finally - the macro that tells us if a pin is an available hardware PWM
329
+#define USEABLE_HARDWARE_PWM(p) (PWM_PINS(p) && !PWM_CHK(p))
330
+
241 331
 #endif // _FASTIO_ARDUINO_H

+ 3
- 1
Marlin/language_en.h View File

@@ -706,7 +706,9 @@
706 706
 #ifndef MSG_CASE_LIGHT
707 707
   #define MSG_CASE_LIGHT                      _UxGT("Case light")
708 708
 #endif
709
-
709
+#ifndef MSG_CASE_LIGHT_BRIGHTNESS
710
+  #define MSG_CASE_LIGHT_BRIGHTNESS           _UxGT("Light BRIGHTNESS")
711
+#endif
710 712
 #if LCD_WIDTH >= 20
711 713
   #ifndef MSG_INFO_PRINT_COUNT
712 714
     #define MSG_INFO_PRINT_COUNT              _UxGT("Print Count")

+ 27
- 9
Marlin/ultralcd.cpp View File

@@ -60,6 +60,7 @@ int lcd_preheat_hotend_temp[2], lcd_preheat_bed_temp[2], lcd_preheat_fan_speed[2
60 60
 
61 61
 uint8_t lcd_status_message_level;
62 62
 char lcd_status_message[3 * (LCD_WIDTH) + 1] = WELCOME_MSG; // worst case is kana with up to 3*LCD_WIDTH+1
63
+
63 64
 #if ENABLED(STATUS_MESSAGE_SCROLLING)
64 65
   uint8_t status_scroll_pos = 0;
65 66
 #endif
@@ -726,6 +727,24 @@ void kill_screen(const char* lcd_msg) {
726 727
 
727 728
   #endif // SDSUPPORT
728 729
 
730
+  #if ENABLED(MENU_ITEM_CASE_LIGHT)
731
+
732
+    extern int case_light_brightness;
733
+    extern bool case_light_on;
734
+    extern void update_case_light();
735
+
736
+    void case_light_menu() {
737
+      START_MENU();
738
+      //
739
+      // ^ Main
740
+      //
741
+      MENU_BACK(MSG_MAIN);
742
+      MENU_ITEM_EDIT_CALLBACK(int3, MSG_CASE_LIGHT_BRIGHTNESS, &case_light_brightness, 0, 255, update_case_light, true);
743
+      MENU_ITEM_EDIT_CALLBACK(bool, MSG_CASE_LIGHT, (bool*)&case_light_on, update_case_light);
744
+      END_MENU();
745
+    }
746
+  #endif // MENU_ITEM_CASE_LIGHT
747
+
729 748
   #if ENABLED(BLTOUCH)
730 749
 
731 750
     /**
@@ -847,11 +866,6 @@ void kill_screen(const char* lcd_msg) {
847 866
    *
848 867
    */
849 868
 
850
-  #if ENABLED(MENU_ITEM_CASE_LIGHT)
851
-    extern bool case_light_on;
852
-    extern void update_case_light();
853
-  #endif
854
-
855 869
   void lcd_main_menu() {
856 870
     START_MENU();
857 871
     MENU_BACK(MSG_WATCH);
@@ -868,10 +882,14 @@ void kill_screen(const char* lcd_msg) {
868 882
     #endif
869 883
 
870 884
     //
871
-    // Switch case light on/off
885
+    // Set Case light on/off/brightness
872 886
     //
873 887
     #if ENABLED(MENU_ITEM_CASE_LIGHT)
874
-      MENU_ITEM_EDIT_CALLBACK(bool, MSG_CASE_LIGHT, &case_light_on, update_case_light);
888
+      if (USEABLE_HARDWARE_PWM(CASE_LIGHT_PIN)) {
889
+        MENU_ITEM(submenu, MSG_CASE_LIGHT, case_light_menu);
890
+      }
891
+      else
892
+        MENU_ITEM_EDIT_CALLBACK(bool, MSG_CASE_LIGHT, (bool*)&case_light_on, update_case_light);
875 893
     #endif
876 894
 
877 895
     if (planner.movesplanned() || IS_SD_PRINTING) {
@@ -1847,7 +1865,7 @@ void kill_screen(const char* lcd_msg) {
1847 1865
      */
1848 1866
     void _lcd_ubl_validate_custom_mesh() {
1849 1867
       char UBL_LCD_GCODE[24];
1850
-      const int temp = 
1868
+      const int temp =
1851 1869
         #if WATCH_THE_BED
1852 1870
           custom_bed_temp
1853 1871
         #else
@@ -2598,7 +2616,7 @@ void kill_screen(const char* lcd_msg) {
2598 2616
     MENU_ITEM(submenu, MSG_FILAMENT, lcd_control_filament_menu);
2599 2617
 
2600 2618
     #if HAS_LCD_CONTRAST
2601
-      MENU_ITEM_EDIT_CALLBACK(int3, MSG_CONTRAST, &lcd_contrast, LCD_CONTRAST_MIN, LCD_CONTRAST_MAX, lcd_callback_set_contrast, true);
2619
+      MENU_ITEM_EDIT_CALLBACK(int3, MSG_CONTRAST, (int) &lcd_contrast, LCD_CONTRAST_MIN, LCD_CONTRAST_MAX, lcd_callback_set_contrast, true);
2602 2620
     #endif
2603 2621
     #if ENABLED(FWRETRACT)
2604 2622
       MENU_ITEM(submenu, MSG_RETRACT, lcd_control_retract_menu);

+ 1
- 1
Marlin/ultralcd.h View File

@@ -59,7 +59,7 @@
59 59
 
60 60
   #if ENABLED(DOGLCD)
61 61
     extern uint16_t lcd_contrast;
62
-    void set_lcd_contrast(uint16_t value);
62
+    void set_lcd_contrast(const uint16_t value);
63 63
   #elif ENABLED(SHOW_BOOTSCREEN)
64 64
     void bootscreen();
65 65
   #endif

Loading…
Cancel
Save