Apply TERN to compact code (#17619)
This commit is contained in:
@@ -63,12 +63,7 @@ enum CalEnum : char { // the 7 main calibration points -
|
||||
#define LOOP_CAL_RAD(VAR) LOOP_CAL_PT(VAR, __A, _7P_STEP)
|
||||
#define LOOP_CAL_ACT(VAR, _4P, _OP) LOOP_CAL_PT(VAR, _OP ? _AB : __A, _4P ? _4P_STEP : _7P_STEP)
|
||||
|
||||
#if HOTENDS > 1
|
||||
const uint8_t old_tool_index = active_extruder;
|
||||
#define AC_CLEANUP() ac_cleanup(old_tool_index)
|
||||
#else
|
||||
#define AC_CLEANUP() ac_cleanup()
|
||||
#endif
|
||||
TERN_(HAS_MULTI_HOTEND, const uint8_t old_tool_index = active_extruder);
|
||||
|
||||
float lcd_probe_pt(const xy_pos_t &xy);
|
||||
|
||||
@@ -79,9 +74,7 @@ void ac_home() {
|
||||
}
|
||||
|
||||
void ac_setup(const bool reset_bed) {
|
||||
#if HOTENDS > 1
|
||||
tool_change(0, true);
|
||||
#endif
|
||||
TERN_(HAS_MULTI_HOTEND, tool_change(0, true));
|
||||
|
||||
planner.synchronize();
|
||||
remember_feedrate_scaling_off();
|
||||
@@ -91,21 +84,11 @@ void ac_setup(const bool reset_bed) {
|
||||
#endif
|
||||
}
|
||||
|
||||
void ac_cleanup(
|
||||
#if HOTENDS > 1
|
||||
const uint8_t old_tool_index
|
||||
#endif
|
||||
) {
|
||||
#if ENABLED(DELTA_HOME_TO_SAFE_ZONE)
|
||||
do_blocking_move_to_z(delta_clip_start_height);
|
||||
#endif
|
||||
#if HAS_BED_PROBE
|
||||
probe.stow();
|
||||
#endif
|
||||
void ac_cleanup(TERN_(HAS_MULTI_HOTEND, const uint8_t old_tool_index)) {
|
||||
TERN_(DELTA_HOME_TO_SAFE_ZONE, do_blocking_move_to_z(delta_clip_start_height));
|
||||
TERN_(HAS_BED_PROBE, probe.stow());
|
||||
restore_feedrate_and_scaling();
|
||||
#if HOTENDS > 1
|
||||
tool_change(old_tool_index, true);
|
||||
#endif
|
||||
TERN_(HAS_MULTI_HOTEND, tool_change(old_tool_index, true));
|
||||
}
|
||||
|
||||
void print_signed_float(PGM_P const prefix, const float &f) {
|
||||
@@ -488,7 +471,7 @@ void GcodeSuite::G33() {
|
||||
zero_std_dev_old = zero_std_dev;
|
||||
if (!probe_calibration_points(z_at_pt, probe_points, towers_set, stow_after_each)) {
|
||||
SERIAL_ECHOLNPGM("Correct delta settings with M665 and M666");
|
||||
return AC_CLEANUP();
|
||||
return ac_cleanup(TERN_(HAS_MULTI_HOTEND, old_tool_index));
|
||||
}
|
||||
zero_std_dev = std_dev_points(z_at_pt, _0p_calibration, _1p_calibration, _4p_calibration, _4p_opposite_points);
|
||||
|
||||
@@ -659,7 +642,7 @@ void GcodeSuite::G33() {
|
||||
}
|
||||
while (((zero_std_dev < test_precision && iterations < 31) || iterations <= force_iterations) && zero_std_dev > calibration_precision);
|
||||
|
||||
AC_CLEANUP();
|
||||
ac_cleanup(TERN_(HAS_MULTI_HOTEND, old_tool_index));
|
||||
}
|
||||
|
||||
#endif // DELTA_AUTO_CALIBRATION
|
||||
|
||||
Reference in New Issue
Block a user