mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2024-11-27 13:56:24 +00:00
Merge pull request #5343 from thinkyhead/rc_invert_case_light
Allow case light pin to be active low
This commit is contained in:
commit
b0361ebe4f
@ -226,8 +226,11 @@
|
||||
|
||||
// Define a pin to turn case light on/off
|
||||
//#define CASE_LIGHT_PIN 4
|
||||
//#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
|
||||
#if PIN_EXISTS(CASE_LIGHT)
|
||||
#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 ==========================
|
||||
|
@ -7328,8 +7328,8 @@ inline void gcode_M907() {
|
||||
uint8_t case_light_brightness = 255;
|
||||
|
||||
void update_case_light() {
|
||||
digitalWrite(CASE_LIGHT_PIN, case_light_on ? HIGH : LOW);
|
||||
analogWrite(CASE_LIGHT_PIN, case_light_on ? case_light_brightness : 0);
|
||||
digitalWrite(CASE_LIGHT_PIN, case_light_on != INVERT_CASE_LIGHT ? HIGH : LOW);
|
||||
analogWrite(CASE_LIGHT_PIN, case_light_on != INVERT_CASE_LIGHT ? case_light_brightness : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -226,8 +226,11 @@
|
||||
|
||||
// Define a pin to turn case light on/off
|
||||
//#define CASE_LIGHT_PIN 4
|
||||
//#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
|
||||
#if PIN_EXISTS(CASE_LIGHT)
|
||||
#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 ==========================
|
||||
|
@ -226,8 +226,11 @@
|
||||
|
||||
// Define a pin to turn case light on/off
|
||||
//#define CASE_LIGHT_PIN 4
|
||||
//#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
|
||||
#if PIN_EXISTS(CASE_LIGHT)
|
||||
#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 ==========================
|
||||
|
@ -226,8 +226,11 @@
|
||||
|
||||
// Define a pin to turn case light on/off
|
||||
//#define CASE_LIGHT_PIN 4
|
||||
//#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
|
||||
#if PIN_EXISTS(CASE_LIGHT)
|
||||
#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 ==========================
|
||||
|
@ -226,8 +226,11 @@
|
||||
|
||||
// Define a pin to turn case light on/off
|
||||
//#define CASE_LIGHT_PIN 4
|
||||
//#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
|
||||
#if PIN_EXISTS(CASE_LIGHT)
|
||||
#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 ==========================
|
||||
|
@ -239,8 +239,11 @@
|
||||
|
||||
// Define a pin to turn case light on/off
|
||||
//#define CASE_LIGHT_PIN 4
|
||||
//#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
|
||||
#if PIN_EXISTS(CASE_LIGHT)
|
||||
#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 ==========================
|
||||
|
@ -226,8 +226,11 @@
|
||||
|
||||
// Define a pin to turn case light on/off
|
||||
//#define CASE_LIGHT_PIN 4
|
||||
//#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
|
||||
#if PIN_EXISTS(CASE_LIGHT)
|
||||
#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 ==========================
|
||||
|
@ -226,8 +226,11 @@
|
||||
|
||||
// Define a pin to turn case light on/off
|
||||
//#define CASE_LIGHT_PIN 4
|
||||
//#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
|
||||
#if PIN_EXISTS(CASE_LIGHT)
|
||||
#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 ==========================
|
||||
|
@ -226,8 +226,11 @@
|
||||
|
||||
// Define a pin to turn case light on/off
|
||||
//#define CASE_LIGHT_PIN 4
|
||||
//#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
|
||||
#if PIN_EXISTS(CASE_LIGHT)
|
||||
#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 ==========================
|
||||
|
@ -234,8 +234,11 @@
|
||||
|
||||
// Define a pin to turn case light on/off
|
||||
//#define CASE_LIGHT_PIN 4
|
||||
//#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
|
||||
#if PIN_EXISTS(CASE_LIGHT)
|
||||
#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 ==========================
|
||||
|
@ -226,8 +226,11 @@
|
||||
|
||||
// Define a pin to turn case light on/off
|
||||
//#define CASE_LIGHT_PIN 4
|
||||
//#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
|
||||
#if PIN_EXISTS(CASE_LIGHT)
|
||||
#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 ==========================
|
||||
|
@ -226,8 +226,11 @@
|
||||
|
||||
// Define a pin to turn case light on/off
|
||||
//#define CASE_LIGHT_PIN 4
|
||||
//#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
|
||||
#if PIN_EXISTS(CASE_LIGHT)
|
||||
#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 ==========================
|
||||
|
@ -226,8 +226,11 @@
|
||||
|
||||
// Define a pin to turn case light on/off
|
||||
//#define CASE_LIGHT_PIN 4
|
||||
//#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
|
||||
#if PIN_EXISTS(CASE_LIGHT)
|
||||
#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 ==========================
|
||||
|
@ -226,8 +226,11 @@
|
||||
|
||||
// Define a pin to turn case light on/off
|
||||
//#define CASE_LIGHT_PIN 4
|
||||
//#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
|
||||
#if PIN_EXISTS(CASE_LIGHT)
|
||||
#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 ==========================
|
||||
|
@ -231,8 +231,11 @@
|
||||
|
||||
// Define a pin to turn case light on/off
|
||||
//#define CASE_LIGHT_PIN 4
|
||||
//#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
|
||||
#if PIN_EXISTS(CASE_LIGHT)
|
||||
#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 ==========================
|
||||
|
@ -226,8 +226,11 @@
|
||||
|
||||
// Define a pin to turn case light on/off
|
||||
//#define CASE_LIGHT_PIN 4
|
||||
//#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
|
||||
#if PIN_EXISTS(CASE_LIGHT)
|
||||
#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 ==========================
|
||||
|
@ -226,8 +226,11 @@
|
||||
|
||||
// Define a pin to turn case light on/off
|
||||
//#define CASE_LIGHT_PIN 4
|
||||
//#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
|
||||
#if PIN_EXISTS(CASE_LIGHT)
|
||||
#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 ==========================
|
||||
|
@ -226,8 +226,11 @@
|
||||
|
||||
// Define a pin to turn case light on/off
|
||||
//#define CASE_LIGHT_PIN 4
|
||||
//#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
|
||||
#if PIN_EXISTS(CASE_LIGHT)
|
||||
#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 ==========================
|
||||
|
@ -581,7 +581,7 @@ void kill_screen(const char* lcd_msg) {
|
||||
|
||||
#endif //SDSUPPORT
|
||||
|
||||
#if HAS_CASE_LIGHT && ENABLED(MENU_ITEM_CASE_LIGHT)
|
||||
#if ENABLED(MENU_ITEM_CASE_LIGHT)
|
||||
|
||||
extern bool case_light_on;
|
||||
extern void update_case_light();
|
||||
@ -607,7 +607,7 @@ void kill_screen(const char* lcd_msg) {
|
||||
//
|
||||
// Switch case light on/off
|
||||
//
|
||||
#if HAS_CASE_LIGHT && ENABLED(MENU_ITEM_CASE_LIGHT)
|
||||
#if ENABLED(MENU_ITEM_CASE_LIGHT)
|
||||
if (case_light_on)
|
||||
MENU_ITEM(function, MSG_LIGHTS_OFF, toggle_case_light);
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user