Browse Source

Allow case light pin to be active low

Scott Lahteine 7 years ago
parent
commit
f60b4f8659

+ 5
- 2
Marlin/Configuration_adv.h View File

226
 
226
 
227
 // Define a pin to turn case light on/off
227
 // Define a pin to turn case light on/off
228
 //#define CASE_LIGHT_PIN 4
228
 //#define CASE_LIGHT_PIN 4
229
-//#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
230
-//#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
229
+#if PIN_EXISTS(CASE_LIGHT)
230
+  #define INVERT_CASE_LIGHT false   // Set to true if HIGH is the OFF state (active low)
231
+  //#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
232
+  //#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
233
+#endif
231
 
234
 
232
 //===========================================================================
235
 //===========================================================================
233
 //============================ Mechanical Settings ==========================
236
 //============================ Mechanical Settings ==========================

+ 2
- 2
Marlin/Marlin_main.cpp View File

7328
   uint8_t case_light_brightness = 255;
7328
   uint8_t case_light_brightness = 255;
7329
 
7329
 
7330
   void update_case_light() {
7330
   void update_case_light() {
7331
-    digitalWrite(CASE_LIGHT_PIN, case_light_on ? HIGH : LOW);
7332
-    analogWrite(CASE_LIGHT_PIN, case_light_on ? case_light_brightness : 0);
7331
+    digitalWrite(CASE_LIGHT_PIN, case_light_on != INVERT_CASE_LIGHT ? HIGH : LOW);
7332
+    analogWrite(CASE_LIGHT_PIN, case_light_on != INVERT_CASE_LIGHT ? case_light_brightness : 0);
7333
   }
7333
   }
7334
 
7334
 
7335
   /**
7335
   /**

+ 5
- 2
Marlin/example_configurations/Cartesio/Configuration_adv.h View File

226
 
226
 
227
 // Define a pin to turn case light on/off
227
 // Define a pin to turn case light on/off
228
 //#define CASE_LIGHT_PIN 4
228
 //#define CASE_LIGHT_PIN 4
229
-//#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
230
-//#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
229
+#if PIN_EXISTS(CASE_LIGHT)
230
+  #define INVERT_CASE_LIGHT false   // Set to true if HIGH is the OFF state (active low)
231
+  //#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
232
+  //#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
233
+#endif
231
 
234
 
232
 //===========================================================================
235
 //===========================================================================
233
 //============================ Mechanical Settings ==========================
236
 //============================ Mechanical Settings ==========================

+ 5
- 2
Marlin/example_configurations/Felix/Configuration_adv.h View File

226
 
226
 
227
 // Define a pin to turn case light on/off
227
 // Define a pin to turn case light on/off
228
 //#define CASE_LIGHT_PIN 4
228
 //#define CASE_LIGHT_PIN 4
229
-//#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
230
-//#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
229
+#if PIN_EXISTS(CASE_LIGHT)
230
+  #define INVERT_CASE_LIGHT false   // Set to true if HIGH is the OFF state (active low)
231
+  //#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
232
+  //#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
233
+#endif
231
 
234
 
232
 //===========================================================================
235
 //===========================================================================
233
 //============================ Mechanical Settings ==========================
236
 //============================ Mechanical Settings ==========================

+ 5
- 2
Marlin/example_configurations/Hephestos/Configuration_adv.h View File

226
 
226
 
227
 // Define a pin to turn case light on/off
227
 // Define a pin to turn case light on/off
228
 //#define CASE_LIGHT_PIN 4
228
 //#define CASE_LIGHT_PIN 4
229
-//#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
230
-//#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
229
+#if PIN_EXISTS(CASE_LIGHT)
230
+  #define INVERT_CASE_LIGHT false   // Set to true if HIGH is the OFF state (active low)
231
+  //#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
232
+  //#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
233
+#endif
231
 
234
 
232
 //===========================================================================
235
 //===========================================================================
233
 //============================ Mechanical Settings ==========================
236
 //============================ Mechanical Settings ==========================

+ 5
- 2
Marlin/example_configurations/Hephestos_2/Configuration_adv.h View File

226
 
226
 
227
 // Define a pin to turn case light on/off
227
 // Define a pin to turn case light on/off
228
 //#define CASE_LIGHT_PIN 4
228
 //#define CASE_LIGHT_PIN 4
229
-//#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
230
-//#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
229
+#if PIN_EXISTS(CASE_LIGHT)
230
+  #define INVERT_CASE_LIGHT false   // Set to true if HIGH is the OFF state (active low)
231
+  //#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
232
+  //#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
233
+#endif
231
 
234
 
232
 //===========================================================================
235
 //===========================================================================
233
 //============================ Mechanical Settings ==========================
236
 //============================ Mechanical Settings ==========================

+ 5
- 2
Marlin/example_configurations/K8200/Configuration_adv.h View File

239
 
239
 
240
 // Define a pin to turn case light on/off
240
 // Define a pin to turn case light on/off
241
 //#define CASE_LIGHT_PIN 4
241
 //#define CASE_LIGHT_PIN 4
242
-//#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
243
-//#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
242
+#if PIN_EXISTS(CASE_LIGHT)
243
+  #define INVERT_CASE_LIGHT false   // Set to true if HIGH is the OFF state (active low)
244
+  //#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
245
+  //#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
246
+#endif
244
 
247
 
245
 //===========================================================================
248
 //===========================================================================
246
 //============================ Mechanical Settings ==========================
249
 //============================ Mechanical Settings ==========================

+ 5
- 2
Marlin/example_configurations/K8400/Configuration_adv.h View File

226
 
226
 
227
 // Define a pin to turn case light on/off
227
 // Define a pin to turn case light on/off
228
 //#define CASE_LIGHT_PIN 4
228
 //#define CASE_LIGHT_PIN 4
229
-//#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
230
-//#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
229
+#if PIN_EXISTS(CASE_LIGHT)
230
+  #define INVERT_CASE_LIGHT false   // Set to true if HIGH is the OFF state (active low)
231
+  //#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
232
+  //#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
233
+#endif
231
 
234
 
232
 //===========================================================================
235
 //===========================================================================
233
 //============================ Mechanical Settings ==========================
236
 //============================ Mechanical Settings ==========================

+ 5
- 2
Marlin/example_configurations/RigidBot/Configuration_adv.h View File

226
 
226
 
227
 // Define a pin to turn case light on/off
227
 // Define a pin to turn case light on/off
228
 //#define CASE_LIGHT_PIN 4
228
 //#define CASE_LIGHT_PIN 4
229
-//#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
230
-//#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
229
+#if PIN_EXISTS(CASE_LIGHT)
230
+  #define INVERT_CASE_LIGHT false   // Set to true if HIGH is the OFF state (active low)
231
+  //#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
232
+  //#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
233
+#endif
231
 
234
 
232
 //===========================================================================
235
 //===========================================================================
233
 //============================ Mechanical Settings ==========================
236
 //============================ Mechanical Settings ==========================

+ 5
- 2
Marlin/example_configurations/SCARA/Configuration_adv.h View File

226
 
226
 
227
 // Define a pin to turn case light on/off
227
 // Define a pin to turn case light on/off
228
 //#define CASE_LIGHT_PIN 4
228
 //#define CASE_LIGHT_PIN 4
229
-//#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
230
-//#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
229
+#if PIN_EXISTS(CASE_LIGHT)
230
+  #define INVERT_CASE_LIGHT false   // Set to true if HIGH is the OFF state (active low)
231
+  //#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
232
+  //#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
233
+#endif
231
 
234
 
232
 //===========================================================================
235
 //===========================================================================
233
 //============================ Mechanical Settings ==========================
236
 //============================ Mechanical Settings ==========================

+ 5
- 2
Marlin/example_configurations/TAZ4/Configuration_adv.h View File

234
 
234
 
235
 // Define a pin to turn case light on/off
235
 // Define a pin to turn case light on/off
236
 //#define CASE_LIGHT_PIN 4
236
 //#define CASE_LIGHT_PIN 4
237
-//#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
238
-//#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
237
+#if PIN_EXISTS(CASE_LIGHT)
238
+  #define INVERT_CASE_LIGHT false   // Set to true if HIGH is the OFF state (active low)
239
+  //#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
240
+  //#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
241
+#endif
239
 
242
 
240
 //===========================================================================
243
 //===========================================================================
241
 //============================ Mechanical Settings ==========================
244
 //============================ Mechanical Settings ==========================

+ 5
- 2
Marlin/example_configurations/WITBOX/Configuration_adv.h View File

226
 
226
 
227
 // Define a pin to turn case light on/off
227
 // Define a pin to turn case light on/off
228
 //#define CASE_LIGHT_PIN 4
228
 //#define CASE_LIGHT_PIN 4
229
-//#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
230
-//#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
229
+#if PIN_EXISTS(CASE_LIGHT)
230
+  #define INVERT_CASE_LIGHT false   // Set to true if HIGH is the OFF state (active low)
231
+  //#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
232
+  //#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
233
+#endif
231
 
234
 
232
 //===========================================================================
235
 //===========================================================================
233
 //============================ Mechanical Settings ==========================
236
 //============================ Mechanical Settings ==========================

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

226
 
226
 
227
 // Define a pin to turn case light on/off
227
 // Define a pin to turn case light on/off
228
 //#define CASE_LIGHT_PIN 4
228
 //#define CASE_LIGHT_PIN 4
229
-//#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
230
-//#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
229
+#if PIN_EXISTS(CASE_LIGHT)
230
+  #define INVERT_CASE_LIGHT false   // Set to true if HIGH is the OFF state (active low)
231
+  //#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
232
+  //#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
233
+#endif
231
 
234
 
232
 //===========================================================================
235
 //===========================================================================
233
 //============================ Mechanical Settings ==========================
236
 //============================ Mechanical Settings ==========================

+ 5
- 2
Marlin/example_configurations/delta/generic/Configuration_adv.h View File

226
 
226
 
227
 // Define a pin to turn case light on/off
227
 // Define a pin to turn case light on/off
228
 //#define CASE_LIGHT_PIN 4
228
 //#define CASE_LIGHT_PIN 4
229
-//#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
230
-//#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
229
+#if PIN_EXISTS(CASE_LIGHT)
230
+  #define INVERT_CASE_LIGHT false   // Set to true if HIGH is the OFF state (active low)
231
+  //#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
232
+  //#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
233
+#endif
231
 
234
 
232
 //===========================================================================
235
 //===========================================================================
233
 //============================ Mechanical Settings ==========================
236
 //============================ Mechanical Settings ==========================

+ 5
- 2
Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h View File

226
 
226
 
227
 // Define a pin to turn case light on/off
227
 // Define a pin to turn case light on/off
228
 //#define CASE_LIGHT_PIN 4
228
 //#define CASE_LIGHT_PIN 4
229
-//#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
230
-//#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
229
+#if PIN_EXISTS(CASE_LIGHT)
230
+  #define INVERT_CASE_LIGHT false   // Set to true if HIGH is the OFF state (active low)
231
+  //#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
232
+  //#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
233
+#endif
231
 
234
 
232
 //===========================================================================
235
 //===========================================================================
233
 //============================ Mechanical Settings ==========================
236
 //============================ Mechanical Settings ==========================

+ 5
- 2
Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h View File

231
 
231
 
232
 // Define a pin to turn case light on/off
232
 // Define a pin to turn case light on/off
233
 //#define CASE_LIGHT_PIN 4
233
 //#define CASE_LIGHT_PIN 4
234
-//#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
235
-//#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
234
+#if PIN_EXISTS(CASE_LIGHT)
235
+  #define INVERT_CASE_LIGHT false   // Set to true if HIGH is the OFF state (active low)
236
+  //#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
237
+  //#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
238
+#endif
236
 
239
 
237
 //===========================================================================
240
 //===========================================================================
238
 //============================ Mechanical Settings ==========================
241
 //============================ Mechanical Settings ==========================

+ 5
- 2
Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h View File

226
 
226
 
227
 // Define a pin to turn case light on/off
227
 // Define a pin to turn case light on/off
228
 //#define CASE_LIGHT_PIN 4
228
 //#define CASE_LIGHT_PIN 4
229
-//#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
230
-//#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
229
+#if PIN_EXISTS(CASE_LIGHT)
230
+  #define INVERT_CASE_LIGHT false   // Set to true if HIGH is the OFF state (active low)
231
+  //#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
232
+  //#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
233
+#endif
231
 
234
 
232
 //===========================================================================
235
 //===========================================================================
233
 //============================ Mechanical Settings ==========================
236
 //============================ Mechanical Settings ==========================

+ 5
- 2
Marlin/example_configurations/makibox/Configuration_adv.h View File

226
 
226
 
227
 // Define a pin to turn case light on/off
227
 // Define a pin to turn case light on/off
228
 //#define CASE_LIGHT_PIN 4
228
 //#define CASE_LIGHT_PIN 4
229
-//#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
230
-//#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
229
+#if PIN_EXISTS(CASE_LIGHT)
230
+  #define INVERT_CASE_LIGHT false   // Set to true if HIGH is the OFF state (active low)
231
+  //#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
232
+  //#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
233
+#endif
231
 
234
 
232
 //===========================================================================
235
 //===========================================================================
233
 //============================ Mechanical Settings ==========================
236
 //============================ Mechanical Settings ==========================

+ 5
- 2
Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h View File

226
 
226
 
227
 // Define a pin to turn case light on/off
227
 // Define a pin to turn case light on/off
228
 //#define CASE_LIGHT_PIN 4
228
 //#define CASE_LIGHT_PIN 4
229
-//#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
230
-//#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
229
+#if PIN_EXISTS(CASE_LIGHT)
230
+  #define INVERT_CASE_LIGHT false   // Set to true if HIGH is the OFF state (active low)
231
+  //#define CASE_LIGHT_DEFAULT_ON   // Uncomment to set default state to on
232
+  //#define MENU_ITEM_CASE_LIGHT    // Uncomment to have a Case Light On / Off entry in main menu
233
+#endif
231
 
234
 
232
 //===========================================================================
235
 //===========================================================================
233
 //============================ Mechanical Settings ==========================
236
 //============================ Mechanical Settings ==========================

+ 2
- 2
Marlin/ultralcd.cpp View File

581
 
581
 
582
   #endif //SDSUPPORT
582
   #endif //SDSUPPORT
583
 
583
 
584
-  #if HAS_CASE_LIGHT && ENABLED(MENU_ITEM_CASE_LIGHT)
584
+  #if ENABLED(MENU_ITEM_CASE_LIGHT)
585
 
585
 
586
     extern bool case_light_on;
586
     extern bool case_light_on;
587
     extern void update_case_light();
587
     extern void update_case_light();
607
     //
607
     //
608
     // Switch case light on/off
608
     // Switch case light on/off
609
     //
609
     //
610
-    #if HAS_CASE_LIGHT && ENABLED(MENU_ITEM_CASE_LIGHT)
610
+    #if ENABLED(MENU_ITEM_CASE_LIGHT)
611
       if (case_light_on)
611
       if (case_light_on)
612
         MENU_ITEM(function, MSG_LIGHTS_OFF, toggle_case_light);
612
         MENU_ITEM(function, MSG_LIGHTS_OFF, toggle_case_light);
613
       else
613
       else

Loading…
Cancel
Save