Changed Configuration_adv.h (issue #9): 1. Uncommented define for CASE_LIGHT_ENABLE 2. Uncommented define for CASE_LIGHT_PIN and changed from 4 to 6 3. Changed CASE_LIGHT_DEFAULT_ON to false 4. Changed CASE_LIGHT_DEFAULT_BRIGHTNESS TO 255 File: Marlin\Configuration_adv.h c482: #define CASE_LIGHT_ENABLE 483: #if ENABLED(CASE_LIGHT_ENABLE) c484: #define CASE_LIGHT_PIN 6 // Override the default pin if needed 485: #define INVERT_CASE_LIGHT false // Set true if Case Light is ON when pin is LOW c486: #define CASE_LIGHT_DEFAULT_ON false // Set default power-up state on c487: #define CASE_LIGHT_DEFAULT_BRIGHTNESS 255 // Set default power-up brightness (0-255, requires PWM pin) 488: //#define CASE_LIGHT_MAX_PWM 128 // Limit pwm 489: //#define CASE_LIGHT_MENU // Add Case Light options to the LCD menu 490: //#define CASE_LIGHT_NO_BRIGHTNESS // Disable brightness control. Enable for non-PWM lighting. 491: //#define CASE_LIGHT_USE_NEOPIXEL // Use NeoPixel LED as case light, requires NEOPIXEL_LED. 492: #if ENABLED(CASE_LIGHT_USE_NEOPIXEL) 493: #define CASE_LIGHT_NEOPIXEL_COLOR { 255, 255, 255, 255 } // { Red, Green, Blue, White } 494: #endif 495: #endif Changed caseLight.cpp (issue #9): 1. Added include for touch_lcd.h after #include "caselight.h"; conditional on Creality touch LCD 2. Added a call to caseLightStatus to set screen status; conditional on Creality touch LCD (had to add code block) File: Marlin\src\feature\caselight.cpp +28: #ifdef DWIN_CREALITY_TOUCHLCD +29: #include "../../lcd/dwin/cr6/touch_lcd.h" +30: #endif File: Marlin\src\feature\caselight.cpp 79: #if DISABLED(CASE_LIGHT_NO_BRIGHTNESS) 80: if (PWM_PIN(CASE_LIGHT_PIN)) +81: { 82: analogWrite(pin_t(CASE_LIGHT_PIN), ( 83: #if CASE_LIGHT_MAX_PWM == 255 84: n10ct 85: #else 86: map(n10ct, 0, 255, 0, CASE_LIGHT_MAX_PWM) 87: #endif 88: )); +89: #ifdef DWIN_CREALITY_TOUCHLCD +90: rtscheck.caseLightStatus(on); +91: #endif +92: } 93: else Changed dwin_touch_lcd.cpp (issue #9): 1. removed call to "OUT_WRITE(LED_CONTROL_PIN, 0)" from DWINTouch_init; this is now controlled by caselight File: Marlin\src\lcd\dwin\dwin_touch_lcd.cpp 65: void DWINTouch_init() { 66: rtscheck.RTS_Init(); 67: 68: #ifdef FIX_MOUNTED_PROBE 69: OUT_WRITE(COM_PIN, 1); 70: SET_INPUT(OPTO_SWITCH_PIN); -71: OUT_WRITE(LED_CONTROL_PIN, 0); 72: #endif 73: } Changed pins_CREALITY_V452.h (issue #9): 1. Removed define for LED_CONTROL_PIN as this is now done by caselight File: Marlin\src\pins\stm32f1\pins_CREALITY_V452.h -145: #define LED_CONTROL_PIN PA6 Changed touch_lcd.h (issue #9) 1. Added function prototype for caseLightStatus File: Marlin\src\lcd\dwin\cr6\touch_lcd.h 245: void RTS_FilamentLoaded(); 246: +247: void caseLightStatus(bool on); // nozzle LED 248: 249: void change_page(DWINTouchPage newPage); 250: void refresh_page(); Changed touch_lcd.cpp (issue #9) 1. Added include for caselight.h 2. Removed declaration of LEDStatus; no longer needed with caselight change 3. In RTS_Init switch call to set LED screen title and LEDStatus to call to caseLightStatus 4. In RTS_HandleData change LED toggle to toggle of caselight.on and call to caselight.update 5. In RTS_HandleData for ChangePageKey case change LED status to call to caseLightStatus 6. Added function caseLightStatus to set screen status File: Marlin\src\lcd\dwin\cr6\touch_lcd.cpp 48: #include "../../../feature/powerloss.h" +49: #include "../../../feature/caselight.h" 50: #include "../../../gcode/gcode.h" 51: File: Marlin\src\lcd\dwin\cr6\touch_lcd.cpp 113: char FilenamesCount = 0; 114: -115: bool LEDStatus = true; 116: RTSSHOW rtscheck; File: Marlin\src\lcd\dwin\cr6\touch_lcd.cpp 287: // turn on fans 288: RTS_SndData(1, PRINTER_FANOPEN_TITLE_VP); -289: RTS_SndData(2, PRINTER_LEDOPEN_TITLE_VP); -290: LEDStatus = true; +289: // set caselight (nozzle LED) status +290: caseLightStatus(caselight.on); File: Marlin\src\lcd\dwin\cr6\touch_lcd.cpp -754: // turn on the LED -755: if(LEDStatus) -756: { -757: RTS_SndData(1, PRINTER_LEDOPEN_TITLE_VP); -758: digitalWrite(LED_CONTROL_PIN, HIGH); -759: LEDStatus = false; -760: } -761: else -762: { -763: // turn off the LED -764: RTS_SndData(2, PRINTER_LEDOPEN_TITLE_VP); -765: digitalWrite(LED_CONTROL_PIN, LOW); -766: LEDStatus = true; -767: } +754: // toggle nozzle LED +755: caselight.on = !caselight.on; +756: caselight.update(caselight.on ? 1 : 0); File: Marlin\src\lcd\dwin\cr6\touch_lcd.cpp -1358: if(LEDStatus) -1359: { -1360: RTS_SndData(1, PRINTER_LEDOPEN_TITLE_VP); -1361: } -1362: else -1363: { -1364: RTS_SndData(2, PRINTER_LEDOPEN_TITLE_VP); -1365: } -1366: +1347: // set nozzle LED status +1348: caseLightStatus(caselight.on); +1349: File: Marlin\src\lcd\dwin\cr6\touch_lcd.cpp +1597: void RTSSHOW::caseLightStatus(bool on) { +1598: // set nozzle LED status to on +1599: if(on) +1600: { +1601: RTS_SndData(1, PRINTER_LEDOPEN_TITLE_VP); +1602: } +1603: else +1604: { +1605: // set nozzle LED status to off +1606: RTS_SndData(2, PRINTER_LEDOPEN_TITLE_VP); +1607: } +1608: } +1609: