🎨 Apply shorthand and cleanups
This commit is contained in:
@ -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);
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ int StepperDAC::init() {
|
||||
mcp4728.setVref_all(DAC_STEPPER_VREF);
|
||||
mcp4728.setGain_all(DAC_STEPPER_GAIN);
|
||||
|
||||
if (mcp4728.getDrvPct(0) < 1 || mcp4728.getDrvPct(1) < 1 || mcp4728.getDrvPct(2) < 1 || mcp4728.getDrvPct(3) < 1 ) {
|
||||
if (mcp4728.getDrvPct(0) < 1 || mcp4728.getDrvPct(1) < 1 || mcp4728.getDrvPct(2) < 1 || mcp4728.getDrvPct(3) < 1) {
|
||||
mcp4728.setDrvPct(dac_channel_pct);
|
||||
mcp4728.eepromWrite();
|
||||
}
|
||||
|
Reference in New Issue
Block a user