Skip to content

Commit 7597b4f

Browse files
committed
🎨 Apply shorthand and cleanups
1 parent 7cd0f2a commit 7597b4f

File tree

5 files changed

+10
-29
lines changed

5 files changed

+10
-29
lines changed

Marlin/src/feature/caselight.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,6 @@ bool CaseLight::on = CASE_LIGHT_DEFAULT_ON;
4444
LEDColor CaseLight::color = { init_case_light[0], init_case_light[1], init_case_light[2], TERN_(HAS_WHITE_LED, init_case_light[3]) };
4545
#endif
4646

47-
#ifndef INVERT_CASE_LIGHT
48-
#define INVERT_CASE_LIGHT false
49-
#endif
50-
5147
void CaseLight::update(const bool sflag) {
5248
#if CASELIGHT_USES_BRIGHTNESS
5349
/**
@@ -64,7 +60,7 @@ void CaseLight::update(const bool sflag) {
6460
if (sflag && on)
6561
brightness = brightness_sav; // Restore last brightness for M355 S1
6662

67-
const uint8_t i = on ? brightness : 0, n10ct = INVERT_CASE_LIGHT ? 255 - i : i;
63+
const uint8_t i = on ? brightness : 0, n10ct = ENABLED(INVERT_CASE_LIGHT) ? 255 - i : i;
6864
UNUSED(n10ct);
6965
#endif
7066

@@ -86,7 +82,7 @@ void CaseLight::update(const bool sflag) {
8682
else
8783
#endif
8884
{
89-
const bool s = on ? !INVERT_CASE_LIGHT : INVERT_CASE_LIGHT;
85+
const bool s = on ? TERN(INVERT_CASE_LIGHT, LOW, HIGH) : TERN(INVERT_CASE_LIGHT, HIGH, LOW);
9086
WRITE(CASE_LIGHT_PIN, s ? HIGH : LOW);
9187
}
9288

Marlin/src/feature/dac/stepper_dac.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ int StepperDAC::init() {
5151
mcp4728.setVref_all(DAC_STEPPER_VREF);
5252
mcp4728.setGain_all(DAC_STEPPER_GAIN);
5353

54-
if (mcp4728.getDrvPct(0) < 1 || mcp4728.getDrvPct(1) < 1 || mcp4728.getDrvPct(2) < 1 || mcp4728.getDrvPct(3) < 1 ) {
54+
if (mcp4728.getDrvPct(0) < 1 || mcp4728.getDrvPct(1) < 1 || mcp4728.getDrvPct(2) < 1 || mcp4728.getDrvPct(3) < 1) {
5555
mcp4728.setDrvPct(dac_channel_pct);
5656
mcp4728.eepromWrite();
5757
}

Marlin/src/gcode/gcode.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
566566
#endif
567567

568568
#if ENABLED(AUTO_REPORT_POSITION)
569-
case 154: M154(); break; // M155: Set position auto-report interval
569+
case 154: M154(); break; // M154: Set position auto-report interval
570570
#endif
571571

572572
#if BOTH(AUTO_REPORT_TEMPERATURES, HAS_TEMP_SENSOR)

Marlin/src/libs/L64XX/L64XX_Marlin.cpp

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -445,12 +445,7 @@ uint8_t L64XX_Marlin::get_user_input(uint8_t &driver_count, L64XX_axis_t axis_in
445445
position_min = X_center - displacement;
446446
position_max = X_center + displacement;
447447
echo_min_max('X', position_min, position_max);
448-
if (false
449-
#if HAS_ENDSTOPS
450-
|| position_min < (X_MIN_POS)
451-
|| position_max > (X_MAX_POS)
452-
#endif
453-
) {
448+
if (TERN0(HAS_ENDSTOPS, position_min < (X_MIN_POS) || position_max > (X_MAX_POS))) {
454449
err_out_of_bounds();
455450
return true;
456451
}
@@ -460,12 +455,7 @@ uint8_t L64XX_Marlin::get_user_input(uint8_t &driver_count, L64XX_axis_t axis_in
460455
position_min = Y_center - displacement;
461456
position_max = Y_center + displacement;
462457
echo_min_max('Y', position_min, position_max);
463-
if (false
464-
#if HAS_ENDSTOPS
465-
|| position_min < (Y_MIN_POS)
466-
|| position_max > (Y_MAX_POS)
467-
#endif
468-
) {
458+
if (TERN0(HAS_ENDSTOPS, position_min < (Y_MIN_POS) || position_max > (Y_MAX_POS))) {
469459
err_out_of_bounds();
470460
return true;
471461
}
@@ -475,12 +465,7 @@ uint8_t L64XX_Marlin::get_user_input(uint8_t &driver_count, L64XX_axis_t axis_in
475465
position_min = Z_center - displacement;
476466
position_max = Z_center + displacement;
477467
echo_min_max('Z', position_min, position_max);
478-
if (false
479-
#if HAS_ENDSTOPS
480-
|| position_min < (Z_MIN_POS)
481-
|| position_max > (Z_MAX_POS)
482-
#endif
483-
) {
468+
if (TERN0(HAS_ENDSTOPS, position_min < (Z_MIN_POS) || position_max > (Z_MAX_POS))) {
484469
err_out_of_bounds();
485470
return true;
486471
}

Marlin/src/module/planner.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ class Planner {
491491
#if HAS_CLASSIC_JERK
492492
static void set_max_jerk(const AxisEnum axis, float inMaxJerkMMS);
493493
#else
494-
static inline void set_max_jerk(const AxisEnum, const_float_t ) {}
494+
static inline void set_max_jerk(const AxisEnum, const_float_t) {}
495495
#endif
496496

497497
#if HAS_EXTRUDERS
@@ -592,9 +592,9 @@ class Planner {
592592

593593
#else
594594

595-
FORCE_INLINE static float fade_scaling_factor_for_z(const_float_t ) { return 1; }
595+
FORCE_INLINE static float fade_scaling_factor_for_z(const_float_t) { return 1; }
596596

597-
FORCE_INLINE static bool leveling_active_at_z(const_float_t ) { return true; }
597+
FORCE_INLINE static bool leveling_active_at_z(const_float_t) { return true; }
598598

599599
#endif
600600

0 commit comments

Comments
 (0)