Merge pull request #5343 from thinkyhead/rc_invert_case_light

Allow case light pin to be active low
This commit is contained in:
Scott Lahteine 2016-12-02 01:17:11 -06:00 committed by GitHub
commit b0361ebe4f
20 changed files with 94 additions and 40 deletions

View file

@ -226,8 +226,11 @@
// Define a pin to turn case light on/off // Define a pin to turn case light on/off
//#define CASE_LIGHT_PIN 4 //#define CASE_LIGHT_PIN 4
//#define CASE_LIGHT_DEFAULT_ON // Uncomment to set default state to on #if PIN_EXISTS(CASE_LIGHT)
//#define MENU_ITEM_CASE_LIGHT // Uncomment to have a Case Light On / Off entry in main menu #define INVERT_CASE_LIGHT false // Set to true if HIGH is the OFF state (active low)
//#define CASE_LIGHT_DEFAULT_ON // Uncomment to set default state to on
//#define MENU_ITEM_CASE_LIGHT // Uncomment to have a Case Light On / Off entry in main menu
#endif
//=========================================================================== //===========================================================================
//============================ Mechanical Settings ========================== //============================ Mechanical Settings ==========================

View file

@ -7328,8 +7328,8 @@ inline void gcode_M907() {
uint8_t case_light_brightness = 255; uint8_t case_light_brightness = 255;
void update_case_light() { void update_case_light() {
digitalWrite(CASE_LIGHT_PIN, case_light_on ? HIGH : LOW); digitalWrite(CASE_LIGHT_PIN, case_light_on != INVERT_CASE_LIGHT ? HIGH : LOW);
analogWrite(CASE_LIGHT_PIN, case_light_on ? case_light_brightness : 0); analogWrite(CASE_LIGHT_PIN, case_light_on != INVERT_CASE_LIGHT ? case_light_brightness : 0);
} }
/** /**

View file

@ -226,8 +226,11 @@
// Define a pin to turn case light on/off // Define a pin to turn case light on/off
//#define CASE_LIGHT_PIN 4 //#define CASE_LIGHT_PIN 4
//#define CASE_LIGHT_DEFAULT_ON // Uncomment to set default state to on #if PIN_EXISTS(CASE_LIGHT)
//#define MENU_ITEM_CASE_LIGHT // Uncomment to have a Case Light On / Off entry in main menu #define INVERT_CASE_LIGHT false // Set to true if HIGH is the OFF state (active low)
//#define CASE_LIGHT_DEFAULT_ON // Uncomment to set default state to on
//#define MENU_ITEM_CASE_LIGHT // Uncomment to have a Case Light On / Off entry in main menu
#endif
//=========================================================================== //===========================================================================
//============================ Mechanical Settings ========================== //============================ Mechanical Settings ==========================

View file

@ -226,8 +226,11 @@
// Define a pin to turn case light on/off // Define a pin to turn case light on/off
//#define CASE_LIGHT_PIN 4 //#define CASE_LIGHT_PIN 4
//#define CASE_LIGHT_DEFAULT_ON // Uncomment to set default state to on #if PIN_EXISTS(CASE_LIGHT)
//#define MENU_ITEM_CASE_LIGHT // Uncomment to have a Case Light On / Off entry in main menu #define INVERT_CASE_LIGHT false // Set to true if HIGH is the OFF state (active low)
//#define CASE_LIGHT_DEFAULT_ON // Uncomment to set default state to on
//#define MENU_ITEM_CASE_LIGHT // Uncomment to have a Case Light On / Off entry in main menu
#endif
//=========================================================================== //===========================================================================
//============================ Mechanical Settings ========================== //============================ Mechanical Settings ==========================

View file

@ -226,8 +226,11 @@
// Define a pin to turn case light on/off // Define a pin to turn case light on/off
//#define CASE_LIGHT_PIN 4 //#define CASE_LIGHT_PIN 4
//#define CASE_LIGHT_DEFAULT_ON // Uncomment to set default state to on #if PIN_EXISTS(CASE_LIGHT)
//#define MENU_ITEM_CASE_LIGHT // Uncomment to have a Case Light On / Off entry in main menu #define INVERT_CASE_LIGHT false // Set to true if HIGH is the OFF state (active low)
//#define CASE_LIGHT_DEFAULT_ON // Uncomment to set default state to on
//#define MENU_ITEM_CASE_LIGHT // Uncomment to have a Case Light On / Off entry in main menu
#endif
//=========================================================================== //===========================================================================
//============================ Mechanical Settings ========================== //============================ Mechanical Settings ==========================

View file

@ -226,8 +226,11 @@
// Define a pin to turn case light on/off // Define a pin to turn case light on/off
//#define CASE_LIGHT_PIN 4 //#define CASE_LIGHT_PIN 4
//#define CASE_LIGHT_DEFAULT_ON // Uncomment to set default state to on #if PIN_EXISTS(CASE_LIGHT)
//#define MENU_ITEM_CASE_LIGHT // Uncomment to have a Case Light On / Off entry in main menu #define INVERT_CASE_LIGHT false // Set to true if HIGH is the OFF state (active low)
//#define CASE_LIGHT_DEFAULT_ON // Uncomment to set default state to on
//#define MENU_ITEM_CASE_LIGHT // Uncomment to have a Case Light On / Off entry in main menu
#endif
//=========================================================================== //===========================================================================
//============================ Mechanical Settings ========================== //============================ Mechanical Settings ==========================

View file

@ -239,8 +239,11 @@
// Define a pin to turn case light on/off // Define a pin to turn case light on/off
//#define CASE_LIGHT_PIN 4 //#define CASE_LIGHT_PIN 4
//#define CASE_LIGHT_DEFAULT_ON // Uncomment to set default state to on #if PIN_EXISTS(CASE_LIGHT)
//#define MENU_ITEM_CASE_LIGHT // Uncomment to have a Case Light On / Off entry in main menu #define INVERT_CASE_LIGHT false // Set to true if HIGH is the OFF state (active low)
//#define CASE_LIGHT_DEFAULT_ON // Uncomment to set default state to on
//#define MENU_ITEM_CASE_LIGHT // Uncomment to have a Case Light On / Off entry in main menu
#endif
//=========================================================================== //===========================================================================
//============================ Mechanical Settings ========================== //============================ Mechanical Settings ==========================

View file

@ -226,8 +226,11 @@
// Define a pin to turn case light on/off // Define a pin to turn case light on/off
//#define CASE_LIGHT_PIN 4 //#define CASE_LIGHT_PIN 4
//#define CASE_LIGHT_DEFAULT_ON // Uncomment to set default state to on #if PIN_EXISTS(CASE_LIGHT)
//#define MENU_ITEM_CASE_LIGHT // Uncomment to have a Case Light On / Off entry in main menu #define INVERT_CASE_LIGHT false // Set to true if HIGH is the OFF state (active low)
//#define CASE_LIGHT_DEFAULT_ON // Uncomment to set default state to on
//#define MENU_ITEM_CASE_LIGHT // Uncomment to have a Case Light On / Off entry in main menu
#endif
//=========================================================================== //===========================================================================
//============================ Mechanical Settings ========================== //============================ Mechanical Settings ==========================

View file

@ -226,8 +226,11 @@
// Define a pin to turn case light on/off // Define a pin to turn case light on/off
//#define CASE_LIGHT_PIN 4 //#define CASE_LIGHT_PIN 4
//#define CASE_LIGHT_DEFAULT_ON // Uncomment to set default state to on #if PIN_EXISTS(CASE_LIGHT)
//#define MENU_ITEM_CASE_LIGHT // Uncomment to have a Case Light On / Off entry in main menu #define INVERT_CASE_LIGHT false // Set to true if HIGH is the OFF state (active low)
//#define CASE_LIGHT_DEFAULT_ON // Uncomment to set default state to on
//#define MENU_ITEM_CASE_LIGHT // Uncomment to have a Case Light On / Off entry in main menu
#endif
//=========================================================================== //===========================================================================
//============================ Mechanical Settings ========================== //============================ Mechanical Settings ==========================

View file

@ -226,8 +226,11 @@
// Define a pin to turn case light on/off // Define a pin to turn case light on/off
//#define CASE_LIGHT_PIN 4 //#define CASE_LIGHT_PIN 4
//#define CASE_LIGHT_DEFAULT_ON // Uncomment to set default state to on #if PIN_EXISTS(CASE_LIGHT)
//#define MENU_ITEM_CASE_LIGHT // Uncomment to have a Case Light On / Off entry in main menu #define INVERT_CASE_LIGHT false // Set to true if HIGH is the OFF state (active low)
//#define CASE_LIGHT_DEFAULT_ON // Uncomment to set default state to on
//#define MENU_ITEM_CASE_LIGHT // Uncomment to have a Case Light On / Off entry in main menu
#endif
//=========================================================================== //===========================================================================
//============================ Mechanical Settings ========================== //============================ Mechanical Settings ==========================

View file

@ -234,8 +234,11 @@
// Define a pin to turn case light on/off // Define a pin to turn case light on/off
//#define CASE_LIGHT_PIN 4 //#define CASE_LIGHT_PIN 4
//#define CASE_LIGHT_DEFAULT_ON // Uncomment to set default state to on #if PIN_EXISTS(CASE_LIGHT)
//#define MENU_ITEM_CASE_LIGHT // Uncomment to have a Case Light On / Off entry in main menu #define INVERT_CASE_LIGHT false // Set to true if HIGH is the OFF state (active low)
//#define CASE_LIGHT_DEFAULT_ON // Uncomment to set default state to on
//#define MENU_ITEM_CASE_LIGHT // Uncomment to have a Case Light On / Off entry in main menu
#endif
//=========================================================================== //===========================================================================
//============================ Mechanical Settings ========================== //============================ Mechanical Settings ==========================

View file

@ -226,8 +226,11 @@
// Define a pin to turn case light on/off // Define a pin to turn case light on/off
//#define CASE_LIGHT_PIN 4 //#define CASE_LIGHT_PIN 4
//#define CASE_LIGHT_DEFAULT_ON // Uncomment to set default state to on #if PIN_EXISTS(CASE_LIGHT)
//#define MENU_ITEM_CASE_LIGHT // Uncomment to have a Case Light On / Off entry in main menu #define INVERT_CASE_LIGHT false // Set to true if HIGH is the OFF state (active low)
//#define CASE_LIGHT_DEFAULT_ON // Uncomment to set default state to on
//#define MENU_ITEM_CASE_LIGHT // Uncomment to have a Case Light On / Off entry in main menu
#endif
//=========================================================================== //===========================================================================
//============================ Mechanical Settings ========================== //============================ Mechanical Settings ==========================

View file

@ -226,8 +226,11 @@
// Define a pin to turn case light on/off // Define a pin to turn case light on/off
//#define CASE_LIGHT_PIN 4 //#define CASE_LIGHT_PIN 4
//#define CASE_LIGHT_DEFAULT_ON // Uncomment to set default state to on #if PIN_EXISTS(CASE_LIGHT)
//#define MENU_ITEM_CASE_LIGHT // Uncomment to have a Case Light On / Off entry in main menu #define INVERT_CASE_LIGHT false // Set to true if HIGH is the OFF state (active low)
//#define CASE_LIGHT_DEFAULT_ON // Uncomment to set default state to on
//#define MENU_ITEM_CASE_LIGHT // Uncomment to have a Case Light On / Off entry in main menu
#endif
//=========================================================================== //===========================================================================
//============================ Mechanical Settings ========================== //============================ Mechanical Settings ==========================

View file

@ -226,8 +226,11 @@
// Define a pin to turn case light on/off // Define a pin to turn case light on/off
//#define CASE_LIGHT_PIN 4 //#define CASE_LIGHT_PIN 4
//#define CASE_LIGHT_DEFAULT_ON // Uncomment to set default state to on #if PIN_EXISTS(CASE_LIGHT)
//#define MENU_ITEM_CASE_LIGHT // Uncomment to have a Case Light On / Off entry in main menu #define INVERT_CASE_LIGHT false // Set to true if HIGH is the OFF state (active low)
//#define CASE_LIGHT_DEFAULT_ON // Uncomment to set default state to on
//#define MENU_ITEM_CASE_LIGHT // Uncomment to have a Case Light On / Off entry in main menu
#endif
//=========================================================================== //===========================================================================
//============================ Mechanical Settings ========================== //============================ Mechanical Settings ==========================

View file

@ -226,8 +226,11 @@
// Define a pin to turn case light on/off // Define a pin to turn case light on/off
//#define CASE_LIGHT_PIN 4 //#define CASE_LIGHT_PIN 4
//#define CASE_LIGHT_DEFAULT_ON // Uncomment to set default state to on #if PIN_EXISTS(CASE_LIGHT)
//#define MENU_ITEM_CASE_LIGHT // Uncomment to have a Case Light On / Off entry in main menu #define INVERT_CASE_LIGHT false // Set to true if HIGH is the OFF state (active low)
//#define CASE_LIGHT_DEFAULT_ON // Uncomment to set default state to on
//#define MENU_ITEM_CASE_LIGHT // Uncomment to have a Case Light On / Off entry in main menu
#endif
//=========================================================================== //===========================================================================
//============================ Mechanical Settings ========================== //============================ Mechanical Settings ==========================

View file

@ -231,8 +231,11 @@
// Define a pin to turn case light on/off // Define a pin to turn case light on/off
//#define CASE_LIGHT_PIN 4 //#define CASE_LIGHT_PIN 4
//#define CASE_LIGHT_DEFAULT_ON // Uncomment to set default state to on #if PIN_EXISTS(CASE_LIGHT)
//#define MENU_ITEM_CASE_LIGHT // Uncomment to have a Case Light On / Off entry in main menu #define INVERT_CASE_LIGHT false // Set to true if HIGH is the OFF state (active low)
//#define CASE_LIGHT_DEFAULT_ON // Uncomment to set default state to on
//#define MENU_ITEM_CASE_LIGHT // Uncomment to have a Case Light On / Off entry in main menu
#endif
//=========================================================================== //===========================================================================
//============================ Mechanical Settings ========================== //============================ Mechanical Settings ==========================

View file

@ -226,8 +226,11 @@
// Define a pin to turn case light on/off // Define a pin to turn case light on/off
//#define CASE_LIGHT_PIN 4 //#define CASE_LIGHT_PIN 4
//#define CASE_LIGHT_DEFAULT_ON // Uncomment to set default state to on #if PIN_EXISTS(CASE_LIGHT)
//#define MENU_ITEM_CASE_LIGHT // Uncomment to have a Case Light On / Off entry in main menu #define INVERT_CASE_LIGHT false // Set to true if HIGH is the OFF state (active low)
//#define CASE_LIGHT_DEFAULT_ON // Uncomment to set default state to on
//#define MENU_ITEM_CASE_LIGHT // Uncomment to have a Case Light On / Off entry in main menu
#endif
//=========================================================================== //===========================================================================
//============================ Mechanical Settings ========================== //============================ Mechanical Settings ==========================

View file

@ -226,8 +226,11 @@
// Define a pin to turn case light on/off // Define a pin to turn case light on/off
//#define CASE_LIGHT_PIN 4 //#define CASE_LIGHT_PIN 4
//#define CASE_LIGHT_DEFAULT_ON // Uncomment to set default state to on #if PIN_EXISTS(CASE_LIGHT)
//#define MENU_ITEM_CASE_LIGHT // Uncomment to have a Case Light On / Off entry in main menu #define INVERT_CASE_LIGHT false // Set to true if HIGH is the OFF state (active low)
//#define CASE_LIGHT_DEFAULT_ON // Uncomment to set default state to on
//#define MENU_ITEM_CASE_LIGHT // Uncomment to have a Case Light On / Off entry in main menu
#endif
//=========================================================================== //===========================================================================
//============================ Mechanical Settings ========================== //============================ Mechanical Settings ==========================

View file

@ -226,8 +226,11 @@
// Define a pin to turn case light on/off // Define a pin to turn case light on/off
//#define CASE_LIGHT_PIN 4 //#define CASE_LIGHT_PIN 4
//#define CASE_LIGHT_DEFAULT_ON // Uncomment to set default state to on #if PIN_EXISTS(CASE_LIGHT)
//#define MENU_ITEM_CASE_LIGHT // Uncomment to have a Case Light On / Off entry in main menu #define INVERT_CASE_LIGHT false // Set to true if HIGH is the OFF state (active low)
//#define CASE_LIGHT_DEFAULT_ON // Uncomment to set default state to on
//#define MENU_ITEM_CASE_LIGHT // Uncomment to have a Case Light On / Off entry in main menu
#endif
//=========================================================================== //===========================================================================
//============================ Mechanical Settings ========================== //============================ Mechanical Settings ==========================

View file

@ -581,7 +581,7 @@ void kill_screen(const char* lcd_msg) {
#endif //SDSUPPORT #endif //SDSUPPORT
#if HAS_CASE_LIGHT && ENABLED(MENU_ITEM_CASE_LIGHT) #if ENABLED(MENU_ITEM_CASE_LIGHT)
extern bool case_light_on; extern bool case_light_on;
extern void update_case_light(); extern void update_case_light();
@ -607,7 +607,7 @@ void kill_screen(const char* lcd_msg) {
// //
// Switch case light on/off // Switch case light on/off
// //
#if HAS_CASE_LIGHT && ENABLED(MENU_ITEM_CASE_LIGHT) #if ENABLED(MENU_ITEM_CASE_LIGHT)
if (case_light_on) if (case_light_on)
MENU_ITEM(function, MSG_LIGHTS_OFF, toggle_case_light); MENU_ITEM(function, MSG_LIGHTS_OFF, toggle_case_light);
else else