🎨 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]) }; LEDColor CaseLight::color = { init_case_light[0], init_case_light[1], init_case_light[2], TERN_(HAS_WHITE_LED, init_case_light[3]) };
#endif #endif
#ifndef INVERT_CASE_LIGHT
#define INVERT_CASE_LIGHT false
#endif
void CaseLight::update(const bool sflag) { void CaseLight::update(const bool sflag) {
#if CASELIGHT_USES_BRIGHTNESS #if CASELIGHT_USES_BRIGHTNESS
/** /**
@ -64,7 +60,7 @@ void CaseLight::update(const bool sflag) {
if (sflag && on) if (sflag && on)
brightness = brightness_sav; // Restore last brightness for M355 S1 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); UNUSED(n10ct);
#endif #endif
@ -86,7 +82,7 @@ void CaseLight::update(const bool sflag) {
else else
#endif #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); WRITE(CASE_LIGHT_PIN, s ? HIGH : LOW);
} }

View file

@ -51,7 +51,7 @@ int StepperDAC::init() {
mcp4728.setVref_all(DAC_STEPPER_VREF); mcp4728.setVref_all(DAC_STEPPER_VREF);
mcp4728.setGain_all(DAC_STEPPER_GAIN); 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.setDrvPct(dac_channel_pct);
mcp4728.eepromWrite(); mcp4728.eepromWrite();
} }

View file

@ -566,7 +566,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
#endif #endif
#if ENABLED(AUTO_REPORT_POSITION) #if ENABLED(AUTO_REPORT_POSITION)
case 154: M154(); break; // M155: Set position auto-report interval case 154: M154(); break; // M154: Set position auto-report interval
#endif #endif
#if BOTH(AUTO_REPORT_TEMPERATURES, HAS_TEMP_SENSOR) #if BOTH(AUTO_REPORT_TEMPERATURES, HAS_TEMP_SENSOR)

View file

@ -445,12 +445,7 @@ uint8_t L64XX_Marlin::get_user_input(uint8_t &driver_count, L64XX_axis_t axis_in
position_min = X_center - displacement; position_min = X_center - displacement;
position_max = X_center + displacement; position_max = X_center + displacement;
echo_min_max('X', position_min, position_max); echo_min_max('X', position_min, position_max);
if (false if (TERN0(HAS_ENDSTOPS, position_min < (X_MIN_POS) || position_max > (X_MAX_POS))) {
#if HAS_ENDSTOPS
|| position_min < (X_MIN_POS)
|| position_max > (X_MAX_POS)
#endif
) {
err_out_of_bounds(); err_out_of_bounds();
return true; return true;
} }
@ -460,12 +455,7 @@ uint8_t L64XX_Marlin::get_user_input(uint8_t &driver_count, L64XX_axis_t axis_in
position_min = Y_center - displacement; position_min = Y_center - displacement;
position_max = Y_center + displacement; position_max = Y_center + displacement;
echo_min_max('Y', position_min, position_max); echo_min_max('Y', position_min, position_max);
if (false if (TERN0(HAS_ENDSTOPS, position_min < (Y_MIN_POS) || position_max > (Y_MAX_POS))) {
#if HAS_ENDSTOPS
|| position_min < (Y_MIN_POS)
|| position_max > (Y_MAX_POS)
#endif
) {
err_out_of_bounds(); err_out_of_bounds();
return true; return true;
} }
@ -475,12 +465,7 @@ uint8_t L64XX_Marlin::get_user_input(uint8_t &driver_count, L64XX_axis_t axis_in
position_min = Z_center - displacement; position_min = Z_center - displacement;
position_max = Z_center + displacement; position_max = Z_center + displacement;
echo_min_max('Z', position_min, position_max); echo_min_max('Z', position_min, position_max);
if (false if (TERN0(HAS_ENDSTOPS, position_min < (Z_MIN_POS) || position_max > (Z_MAX_POS))) {
#if HAS_ENDSTOPS
|| position_min < (Z_MIN_POS)
|| position_max > (Z_MAX_POS)
#endif
) {
err_out_of_bounds(); err_out_of_bounds();
return true; return true;
} }

View file

@ -491,7 +491,7 @@ class Planner {
#if HAS_CLASSIC_JERK #if HAS_CLASSIC_JERK
static void set_max_jerk(const AxisEnum axis, float inMaxJerkMMS); static void set_max_jerk(const AxisEnum axis, float inMaxJerkMMS);
#else #else
static inline void set_max_jerk(const AxisEnum, const_float_t ) {} static inline void set_max_jerk(const AxisEnum, const_float_t) {}
#endif #endif
#if HAS_EXTRUDERS #if HAS_EXTRUDERS
@ -592,9 +592,9 @@ class Planner {
#else #else
FORCE_INLINE static float fade_scaling_factor_for_z(const_float_t ) { return 1; } FORCE_INLINE static float fade_scaling_factor_for_z(const_float_t) { return 1; }
FORCE_INLINE static bool leveling_active_at_z(const_float_t ) { return true; } FORCE_INLINE static bool leveling_active_at_z(const_float_t) { return true; }
#endif #endif