Fix case light "off" function (#8205)

* Fix case light "off" function

It would only turn the light off if brightness was 255

* Update Marlin_main.cpp
This commit is contained in:
jmdearras 2017-11-01 22:17:23 -04:00 committed by Scott Lahteine
parent 1b68ee82ce
commit 3e9504d306

View File

@ -10468,12 +10468,17 @@ inline void gcode_M907() {
void update_case_light() { void update_case_light() {
pinMode(CASE_LIGHT_PIN, OUTPUT); // digitalWrite doesn't set the port mode pinMode(CASE_LIGHT_PIN, OUTPUT); // digitalWrite doesn't set the port mode
if (case_light_on) { if (case_light_on) {
if (USEABLE_HARDWARE_PWM(CASE_LIGHT_PIN)) { if (USEABLE_HARDWARE_PWM(CASE_LIGHT_PIN))
analogWrite(CASE_LIGHT_PIN, INVERT_CASE_LIGHT ? 255 - case_light_brightness : case_light_brightness); analogWrite(CASE_LIGHT_PIN, INVERT_CASE_LIGHT ? 255 - case_light_brightness : case_light_brightness);
} else
else WRITE(CASE_LIGHT_PIN, INVERT_CASE_LIGHT ? LOW : HIGH); 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);
else
WRITE(CASE_LIGHT_PIN, INVERT_CASE_LIGHT ? HIGH : LOW);
} }
else WRITE(CASE_LIGHT_PIN, INVERT_CASE_LIGHT ? HIGH : LOW);
} }
#endif // HAS_CASE_LIGHT #endif // HAS_CASE_LIGHT