Apply TERN to compact code (#17619)
This commit is contained in:
@@ -109,12 +109,8 @@
|
||||
namespace ExtUI {
|
||||
static struct {
|
||||
uint8_t printer_killed : 1;
|
||||
#if ENABLED(JOYSTICK)
|
||||
uint8_t jogging : 1;
|
||||
#endif
|
||||
#if ENABLED(SDSUPPORT)
|
||||
uint8_t was_sd_printing : 1;
|
||||
#endif
|
||||
TERN_(JOYSTICK, uint8_t jogging : 1);
|
||||
TERN_(SDSUPPORT, uint8_t was_sd_printing : 1);
|
||||
} flags;
|
||||
|
||||
#ifdef __SAM3X8E__
|
||||
@@ -192,9 +188,7 @@ namespace ExtUI {
|
||||
case CHAMBER: return; // Chamber has no idle timer
|
||||
#endif
|
||||
default:
|
||||
#if HAS_HOTEND
|
||||
thermalManager.reset_hotend_idle_timer(heater - H0);
|
||||
#endif
|
||||
TERN_(HAS_HOTEND, thermalManager.reset_hotend_idle_timer(heater - H0));
|
||||
break;
|
||||
}
|
||||
#else
|
||||
@@ -251,9 +245,7 @@ namespace ExtUI {
|
||||
bool isHeaterIdle(const heater_t heater) {
|
||||
#if HEATER_IDLE_HANDLER
|
||||
switch (heater) {
|
||||
#if HAS_HEATED_BED
|
||||
case BED: return thermalManager.bed_idle.timed_out;
|
||||
#endif
|
||||
TERN_(HAS_HEATED_BED, case BED: return thermalManager.bed_idle.timed_out);
|
||||
#if HAS_HEATED_CHAMBER
|
||||
case CHAMBER: return false; // Chamber has no idle timer
|
||||
#endif
|
||||
@@ -278,12 +270,8 @@ namespace ExtUI {
|
||||
|
||||
float getActualTemp_celsius(const heater_t heater) {
|
||||
switch (heater) {
|
||||
#if HAS_HEATED_BED
|
||||
case BED: return GET_TEMP_ADJUSTMENT(thermalManager.degBed());
|
||||
#endif
|
||||
#if HAS_HEATED_CHAMBER
|
||||
case CHAMBER: return GET_TEMP_ADJUSTMENT(thermalManager.degChamber());
|
||||
#endif
|
||||
TERN_(HAS_HEATED_BED, case BED: return GET_TEMP_ADJUSTMENT(thermalManager.degBed()));
|
||||
TERN_(HAS_HEATED_CHAMBER, case CHAMBER: return GET_TEMP_ADJUSTMENT(thermalManager.degChamber()));
|
||||
default: return GET_TEMP_ADJUSTMENT(thermalManager.degHotend(heater - H0));
|
||||
}
|
||||
}
|
||||
@@ -294,12 +282,8 @@ namespace ExtUI {
|
||||
|
||||
float getTargetTemp_celsius(const heater_t heater) {
|
||||
switch (heater) {
|
||||
#if HAS_HEATED_BED
|
||||
case BED: return GET_TEMP_ADJUSTMENT(thermalManager.degTargetBed());
|
||||
#endif
|
||||
#if HAS_HEATED_CHAMBER
|
||||
case CHAMBER: return GET_TEMP_ADJUSTMENT(thermalManager.degTargetChamber());
|
||||
#endif
|
||||
TERN_(HAS_HEATED_BED, case BED: return GET_TEMP_ADJUSTMENT(thermalManager.degTargetBed()));
|
||||
TERN_(HAS_HEATED_CHAMBER, case CHAMBER: return GET_TEMP_ADJUSTMENT(thermalManager.degTargetChamber()));
|
||||
default: return GET_TEMP_ADJUSTMENT(thermalManager.degTargetHotend(heater - H0));
|
||||
}
|
||||
}
|
||||
@@ -356,28 +340,16 @@ namespace ExtUI {
|
||||
#if HAS_SOFTWARE_ENDSTOPS
|
||||
if (soft_endstops_enabled) switch (axis) {
|
||||
case X_AXIS:
|
||||
#if ENABLED(MIN_SOFTWARE_ENDSTOP_X)
|
||||
min = soft_endstop.min.x;
|
||||
#endif
|
||||
#if ENABLED(MAX_SOFTWARE_ENDSTOP_X)
|
||||
max = soft_endstop.max.x;
|
||||
#endif
|
||||
TERN_(MIN_SOFTWARE_ENDSTOP_X, min = soft_endstop.min.x);
|
||||
TERN_(MAX_SOFTWARE_ENDSTOP_X, max = soft_endstop.max.x);
|
||||
break;
|
||||
case Y_AXIS:
|
||||
#if ENABLED(MIN_SOFTWARE_ENDSTOP_Y)
|
||||
min = soft_endstop.min.y;
|
||||
#endif
|
||||
#if ENABLED(MAX_SOFTWARE_ENDSTOP_Y)
|
||||
max = soft_endstop.max.y;
|
||||
#endif
|
||||
TERN_(MIN_SOFTWARE_ENDSTOP_Y, min = soft_endstop.min.y);
|
||||
TERN_(MAX_SOFTWARE_ENDSTOP_Y, max = soft_endstop.max.y);
|
||||
break;
|
||||
case Z_AXIS:
|
||||
#if ENABLED(MIN_SOFTWARE_ENDSTOP_Z)
|
||||
min = soft_endstop.min.z;
|
||||
#endif
|
||||
#if ENABLED(MAX_SOFTWARE_ENDSTOP_Z)
|
||||
max = soft_endstop.max.z;
|
||||
#endif
|
||||
TERN_(MIN_SOFTWARE_ENDSTOP_Z, min = soft_endstop.min.z);
|
||||
TERN_(MAX_SOFTWARE_ENDSTOP_Z, max = soft_endstop.max.z);
|
||||
default: break;
|
||||
}
|
||||
#endif // HAS_SOFTWARE_ENDSTOPS
|
||||
@@ -541,15 +513,9 @@ namespace ExtUI {
|
||||
|
||||
int getTMCBumpSensitivity(const axis_t axis) {
|
||||
switch (axis) {
|
||||
#if X_SENSORLESS
|
||||
case X: return stepperX.homing_threshold();
|
||||
#endif
|
||||
#if Y_SENSORLESS
|
||||
case Y: return stepperY.homing_threshold();
|
||||
#endif
|
||||
#if Z_SENSORLESS
|
||||
case Z: return stepperZ.homing_threshold();
|
||||
#endif
|
||||
TERN_(X_SENSORLESS, case X: return stepperX.homing_threshold());
|
||||
TERN_(Y_SENSORLESS, case Y: return stepperY.homing_threshold());
|
||||
TERN_(Z_SENSORLESS, case Z: return stepperZ.homing_threshold());
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
@@ -673,9 +639,7 @@ namespace ExtUI {
|
||||
|
||||
void setJunctionDeviation_mm(const float value) {
|
||||
planner.junction_deviation_mm = constrain(value, 0.01, 0.3);
|
||||
#if ENABLED(LIN_ADVANCE)
|
||||
planner.recalculate_max_e_jerk();
|
||||
#endif
|
||||
TERN_(LIN_ADVANCE, planner.recalculate_max_e_jerk());
|
||||
}
|
||||
|
||||
#else
|
||||
@@ -871,9 +835,7 @@ namespace ExtUI {
|
||||
void setMeshPoint(const xy_uint8_t &pos, const float zoff) {
|
||||
if (WITHIN(pos.x, 0, GRID_MAX_POINTS_X) && WITHIN(pos.y, 0, GRID_MAX_POINTS_Y)) {
|
||||
Z_VALUES(pos.x, pos.y) = zoff;
|
||||
#if ENABLED(ABL_BILINEAR_SUBDIVISION)
|
||||
bed_level_virt_interpolate();
|
||||
#endif
|
||||
TERN_(ABL_BILINEAR_SUBDIVISION, bed_level_virt_interpolate());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1020,9 +982,7 @@ namespace ExtUI {
|
||||
}
|
||||
|
||||
void setUserConfirmed() {
|
||||
#if HAS_RESUME_CONTINUE
|
||||
wait_for_user = false;
|
||||
#endif
|
||||
TERN_(HAS_RESUME_CONTINUE, wait_for_user = false);
|
||||
}
|
||||
|
||||
void printFile(const char *filename) {
|
||||
|
Reference in New Issue
Block a user