From f7133e53fd8ebd8e74214972c0cc1fdd414a35dc Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 1 Nov 2017 21:22:15 -0500 Subject: [PATCH] Fix case light off Addressing #8205 --- Marlin/src/feature/caselight.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Marlin/src/feature/caselight.cpp b/Marlin/src/feature/caselight.cpp index 839fc946fd..5cb00a5285 100644 --- a/Marlin/src/feature/caselight.cpp +++ b/Marlin/src/feature/caselight.cpp @@ -49,15 +49,16 @@ void update_case_light() { case_light_brightness = case_light_brightness_sav; // restore last brightens if this is an S1 arguement if (case_light_on) { - if (USEABLE_HARDWARE_PWM(CASE_LIGHT_PIN)) { - analogWrite(CASE_LIGHT_PIN, INVERT_CASE_LIGHT ? 255 - case_light_brightness : case_light_brightness ); - } - else WRITE(CASE_LIGHT_PIN, INVERT_CASE_LIGHT ? LOW : HIGH); + if (USEABLE_HARDWARE_PWM(CASE_LIGHT_PIN)) + analogWrite(CASE_LIGHT_PIN, INVERT_CASE_LIGHT ? 255 - case_light_brightness : case_light_brightness); + else + WRITE(CASE_LIGHT_PIN, INVERT_CASE_LIGHT ? LOW : HIGH); } else { if (USEABLE_HARDWARE_PWM(CASE_LIGHT_PIN)) - analogWrite(CASE_LIGHT_PIN, INVERT_CASE_LIGHT ? 255 : 0 ); // turn the light off - WRITE(CASE_LIGHT_PIN, INVERT_CASE_LIGHT ? HIGH : LOW); + analogWrite(CASE_LIGHT_PIN, INVERT_CASE_LIGHT ? 255 : 0); + else + WRITE(CASE_LIGHT_PIN, INVERT_CASE_LIGHT ? HIGH : LOW); } }