🎨 Apply shorthand and cleanups

This commit is contained in:
Scott Lahteine
2021-05-22 21:12:53 -05:00
parent ff0318c5bd
commit d71b35c24f
5 changed files with 10 additions and 29 deletions

View File

@@ -44,10 +44,6 @@ bool CaseLight::on = CASE_LIGHT_DEFAULT_ON;
LEDColor CaseLight::color = { init_case_light[0], init_case_light[1], init_case_light[2], TERN_(HAS_WHITE_LED, init_case_light[3]) };
#endif
#ifndef INVERT_CASE_LIGHT
#define INVERT_CASE_LIGHT false
#endif
void CaseLight::update(const bool sflag) {
#if CASELIGHT_USES_BRIGHTNESS
/**
@@ -64,7 +60,7 @@ void CaseLight::update(const bool sflag) {
if (sflag && on)
brightness = brightness_sav; // Restore last brightness for M355 S1
const uint8_t i = on ? brightness : 0, n10ct = INVERT_CASE_LIGHT ? 255 - i : i;
const uint8_t i = on ? brightness : 0, n10ct = ENABLED(INVERT_CASE_LIGHT) ? 255 - i : i;
UNUSED(n10ct);
#endif
@@ -86,7 +82,7 @@ void CaseLight::update(const bool sflag) {
else
#endif
{
const bool s = on ? !INVERT_CASE_LIGHT : INVERT_CASE_LIGHT;
const bool s = on ? TERN(INVERT_CASE_LIGHT, LOW, HIGH) : TERN(INVERT_CASE_LIGHT, HIGH, LOW);
WRITE(CASE_LIGHT_PIN, s ? HIGH : LOW);
}