Apply TERN to compact code (#17619)

This commit is contained in:
Scott Lahteine
2020-04-22 16:35:03 -05:00
committed by GitHub
parent 88bdd26c99
commit 6d90d1e1f5
162 changed files with 1493 additions and 3530 deletions

View File

@ -165,9 +165,7 @@ int8_t g26_prime_flag;
bool user_canceled() {
if (!ui.button_pressed()) return false; // Return if the button isn't pressed
ui.set_status_P(GET_TEXT(MSG_G26_CANCELED), 99);
#if HAS_LCD_MENU
ui.quick_feedback();
#endif
TERN_(HAS_LCD_MENU, ui.quick_feedback());
ui.wait_for_release();
return true;
}
@ -301,9 +299,7 @@ inline bool look_for_lines_to_connect() {
GRID_LOOP(i, j) {
#if HAS_LCD_MENU
if (user_canceled()) return true;
#endif
if (TERN0(HAS_LCD_MENU, user_canceled())) return true;
if (i < (GRID_MAX_POINTS_X)) { // Can't connect to anything farther to the right than GRID_MAX_POINTS_X.
// Already a half circle at the edge of the bed.
@ -364,9 +360,7 @@ inline bool turn_on_heaters() {
#if HAS_SPI_LCD
ui.set_status_P(GET_TEXT(MSG_G26_HEATING_BED), 99);
ui.quick_feedback();
#if HAS_LCD_MENU
ui.capture();
#endif
TERN_(HAS_LCD_MENU, ui.capture());
#endif
thermalManager.setTargetBed(g26_bed_temp);
@ -390,11 +384,10 @@ inline bool turn_on_heaters() {
// Wait for the temperature to stabilize
if (!thermalManager.wait_for_hotend(active_extruder, true
#if G26_CLICK_CAN_CANCEL
, true
#endif
)
) return G26_ERR;
#if G26_CLICK_CAN_CANCEL
, true
#endif
)) return G26_ERR;
#if HAS_SPI_LCD
ui.reset_status();
@ -665,9 +658,7 @@ void GcodeSuite::G26() {
move_to(destination, 0.0);
move_to(destination, g26_ooze_amount);
#if HAS_LCD_MENU
ui.capture();
#endif
TERN_(HAS_LCD_MENU, ui.capture());
#if DISABLED(ARC_SUPPORT)
@ -762,9 +753,7 @@ void GcodeSuite::G26() {
feedrate_mm_s = old_feedrate;
destination = current_position;
#if HAS_LCD_MENU
if (user_canceled()) goto LEAVE; // Check if the user wants to stop the Mesh Validation
#endif
if (TERN0(HAS_LCD_MENU, user_canceled())) goto LEAVE; // Check if the user wants to stop the Mesh Validation
#else // !ARC_SUPPORT
@ -788,9 +777,7 @@ void GcodeSuite::G26() {
for (int8_t ind = start_ind; ind <= end_ind; ind++) {
#if HAS_LCD_MENU
if (user_canceled()) goto LEAVE; // Check if the user wants to stop the Mesh Validation
#endif
if (TERN0(HAS_LCD_MENU, user_canceled())) goto LEAVE; // Check if the user wants to stop the Mesh Validation
xyz_float_t p = { circle.x + _COS(ind ), circle.y + _SIN(ind ), g26_layer_height },
q = { circle.x + _COS(ind + 1), circle.y + _SIN(ind + 1), g26_layer_height };
@ -833,14 +820,10 @@ void GcodeSuite::G26() {
planner.calculate_volumetric_multipliers();
#endif
#if HAS_LCD_MENU
ui.release(); // Give back control of the LCD
#endif
TERN_(HAS_LCD_MENU, ui.release()); // Give back control of the LCD
if (!g26_keep_heaters_on) {
#if HAS_HEATED_BED
thermalManager.setTargetBed(0);
#endif
TERN_(HAS_HEATED_BED, thermalManager.setTargetBed(0));
thermalManager.setTargetHotend(active_extruder, 0);
}
}

View File

@ -73,9 +73,7 @@ void GcodeSuite::M420() {
#endif
GRID_LOOP(x, y) {
Z_VALUES(x, y) = 0.001 * random(-200, 200);
#if ENABLED(EXTENSIBLE_UI)
ExtUI::onMeshUpdate(x, y, Z_VALUES(x, y));
#endif
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(x, y, Z_VALUES(x, y)));
}
SERIAL_ECHOPGM("Simulated " STRINGIFY(GRID_MAX_POINTS_X) "x" STRINGIFY(GRID_MAX_POINTS_Y) " mesh ");
SERIAL_ECHOPAIR(" (", x_min);
@ -178,13 +176,9 @@ void GcodeSuite::M420() {
// Subtract the mean from all values
GRID_LOOP(x, y) {
Z_VALUES(x, y) -= zmean;
#if ENABLED(EXTENSIBLE_UI)
ExtUI::onMeshUpdate(x, y, Z_VALUES(x, y));
#endif
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(x, y, Z_VALUES(x, y)));
}
#if ENABLED(ABL_BILINEAR_SUBDIVISION)
bed_level_virt_interpolate();
#endif
TERN_(ABL_BILINEAR_SUBDIVISION, bed_level_virt_interpolate());
}
#endif
@ -206,9 +200,7 @@ void GcodeSuite::M420() {
if (leveling_is_valid()) {
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
print_bilinear_leveling_grid();
#if ENABLED(ABL_BILINEAR_SUBDIVISION)
print_bilinear_leveling_grid_virt();
#endif
TERN_(ABL_BILINEAR_SUBDIVISION, print_bilinear_leveling_grid_virt());
#elif ENABLED(MESH_BED_LEVELING)
SERIAL_ECHOLNPGM("Mesh Bed Level data:");
mbl.report_mesh();

View File

@ -283,9 +283,7 @@ G29_TYPE GcodeSuite::G29() {
*/
if (!g29_in_progress) {
#if HAS_MULTI_HOTEND
if (active_extruder != 0) tool_change(0);
#endif
TERN_(HAS_MULTI_HOTEND, if (active_extruder) tool_change(0));
#if EITHER(PROBE_MANUALLY, AUTO_BED_LEVELING_LINEAR)
abl_probe_index = -1;
@ -322,12 +320,8 @@ G29_TYPE GcodeSuite::G29() {
if (WITHIN(i, 0, GRID_MAX_POINTS_X - 1) && WITHIN(j, 0, GRID_MAX_POINTS_Y)) {
set_bed_leveling_enabled(false);
z_values[i][j] = rz;
#if ENABLED(ABL_BILINEAR_SUBDIVISION)
bed_level_virt_interpolate();
#endif
#if ENABLED(EXTENSIBLE_UI)
ExtUI::onMeshUpdate(i, j, rz);
#endif
TERN_(ABL_BILINEAR_SUBDIVISION, bed_level_virt_interpolate());
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(i, j, rz));
set_bed_leveling_enabled(abl_should_enable);
if (abl_should_enable) report_current_position();
}
@ -492,14 +486,10 @@ G29_TYPE GcodeSuite::G29() {
// Abort current G29 procedure, go back to idle state
if (seenA && g29_in_progress) {
SERIAL_ECHOLNPGM("Manual G29 aborted");
#if HAS_SOFTWARE_ENDSTOPS
soft_endstops_enabled = saved_soft_endstops_state;
#endif
TERN_(HAS_SOFTWARE_ENDSTOPS, soft_endstops_enabled = saved_soft_endstops_state);
set_bed_leveling_enabled(abl_should_enable);
g29_in_progress = false;
#if ENABLED(LCD_BED_LEVELING)
ui.wait_for_move = false;
#endif
TERN_(LCD_BED_LEVELING, ui.wait_for_move = false);
}
// Query G29 status
@ -517,9 +507,7 @@ G29_TYPE GcodeSuite::G29() {
if (abl_probe_index == 0) {
// For the initial G29 S2 save software endstop state
#if HAS_SOFTWARE_ENDSTOPS
saved_soft_endstops_state = soft_endstops_enabled;
#endif
TERN_(HAS_SOFTWARE_ENDSTOPS, saved_soft_endstops_state = soft_endstops_enabled);
// Move close to the bed before the first point
do_blocking_move_to_z(0);
}
@ -551,9 +539,7 @@ G29_TYPE GcodeSuite::G29() {
const float newz = measured_z + zoffset;
z_values[meshCount.x][meshCount.y] = newz;
#if ENABLED(EXTENSIBLE_UI)
ExtUI::onMeshUpdate(meshCount, newz);
#endif
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(meshCount, newz));
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR_P(PSTR("Save X"), meshCount.x, SP_Y_STR, meshCount.y, SP_Z_STR, measured_z + zoffset);
@ -580,9 +566,7 @@ G29_TYPE GcodeSuite::G29() {
probePos = probe_position_lf + gridSpacing * meshCount.asFloat();
#if ENABLED(AUTO_BED_LEVELING_LINEAR)
indexIntoAB[meshCount.x][meshCount.y] = abl_probe_index;
#endif
TERN_(AUTO_BED_LEVELING_LINEAR, indexIntoAB[meshCount.x][meshCount.y] = abl_probe_index);
// Keep looping till a reachable point is found
if (position_is_reachable(probePos)) break;
@ -606,9 +590,7 @@ G29_TYPE GcodeSuite::G29() {
SERIAL_ECHOLNPGM("Grid probing done.");
// Re-enable software endstops, if needed
#if HAS_SOFTWARE_ENDSTOPS
soft_endstops_enabled = saved_soft_endstops_state;
#endif
TERN_(HAS_SOFTWARE_ENDSTOPS, soft_endstops_enabled = saved_soft_endstops_state);
}
#elif ENABLED(AUTO_BED_LEVELING_3POINT)
@ -629,9 +611,7 @@ G29_TYPE GcodeSuite::G29() {
SERIAL_ECHOLNPGM("3-point probing done.");
// Re-enable software endstops, if needed
#if HAS_SOFTWARE_ENDSTOPS
soft_endstops_enabled = saved_soft_endstops_state;
#endif
TERN_(HAS_SOFTWARE_ENDSTOPS, soft_endstops_enabled = saved_soft_endstops_state);
if (!dryrun) {
vector_3 planeNormal = vector_3::cross(points[0] - points[1], points[2] - points[1]).get_normal();
@ -688,9 +668,7 @@ G29_TYPE GcodeSuite::G29() {
probePos = probe_position_lf + gridSpacing * meshCount.asFloat();
#if ENABLED(AUTO_BED_LEVELING_LINEAR)
indexIntoAB[meshCount.x][meshCount.y] = ++abl_probe_index; // 0...
#endif
TERN_(AUTO_BED_LEVELING_LINEAR, indexIntoAB[meshCount.x][meshCount.y] = ++abl_probe_index); // 0...
#if IS_KINEMATIC
// Avoid probing outside the round or hexagonal area
@ -698,9 +676,7 @@ G29_TYPE GcodeSuite::G29() {
#endif
if (verbose_level) SERIAL_ECHOLNPAIR("Probing mesh point ", int(pt_index), "/", int(GRID_MAX_POINTS), ".");
#if HAS_DISPLAY
ui.status_printf_P(0, PSTR(S_FMT " %i/%i"), GET_TEXT(MSG_PROBING_MESH), int(pt_index), int(GRID_MAX_POINTS));
#endif
TERN_(HAS_DISPLAY, ui.status_printf_P(0, PSTR(S_FMT " %i/%i"), GET_TEXT(MSG_PROBING_MESH), int(pt_index), int(GRID_MAX_POINTS)));
measured_z = faux ? 0.001f * random(-100, 101) : probe.probe_at_point(probePos, raise_after, verbose_level);
@ -712,9 +688,7 @@ G29_TYPE GcodeSuite::G29() {
#if ENABLED(PROBE_TEMP_COMPENSATION)
temp_comp.compensate_measurement(TSI_BED, thermalManager.degBed(), measured_z);
temp_comp.compensate_measurement(TSI_PROBE, thermalManager.degProbe(), measured_z);
#if ENABLED(USE_TEMP_EXT_COMPENSATION)
temp_comp.compensate_measurement(TSI_EXT, thermalManager.degHotend(), measured_z);
#endif
TERN_(USE_TEMP_EXT_COMPENSATION, temp_comp.compensate_measurement(TSI_EXT, thermalManager.degHotend(), measured_z));
#endif
#if ENABLED(AUTO_BED_LEVELING_LINEAR)
@ -730,9 +704,7 @@ G29_TYPE GcodeSuite::G29() {
#elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
z_values[meshCount.x][meshCount.y] = measured_z + zoffset;
#if ENABLED(EXTENSIBLE_UI)
ExtUI::onMeshUpdate(meshCount, z_values[meshCount.x][meshCount.y]);
#endif
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(meshCount, z_values[meshCount.x][meshCount.y]));
#endif
@ -748,9 +720,7 @@ G29_TYPE GcodeSuite::G29() {
LOOP_L_N(i, 3) {
if (verbose_level) SERIAL_ECHOLNPAIR("Probing point ", int(i), "/3.");
#if HAS_DISPLAY
ui.status_printf_P(0, PSTR(S_FMT " %i/3"), GET_TEXT(MSG_PROBING_MESH), int(i));
#endif
TERN_(HAS_DISPLAY, ui.status_printf_P(0, PSTR(S_FMT " %i/3"), GET_TEXT(MSG_PROBING_MESH), int(i)));
// Retain the last probe position
probePos = points[i];
@ -773,9 +743,7 @@ G29_TYPE GcodeSuite::G29() {
#endif // AUTO_BED_LEVELING_3POINT
#if HAS_DISPLAY
ui.reset_status();
#endif
TERN_(HAS_DISPLAY, ui.reset_status());
// Stow the probe. No raise for FIX_MOUNTED_PROBE.
if (probe.stow()) {
@ -799,9 +767,7 @@ G29_TYPE GcodeSuite::G29() {
#if ENABLED(PROBE_MANUALLY)
g29_in_progress = false;
#if ENABLED(LCD_BED_LEVELING)
ui.wait_for_move = false;
#endif
TERN_(LCD_BED_LEVELING, ui.wait_for_move = false);
#endif
// Calculate leveling, print reports, correct the position
@ -813,9 +779,7 @@ G29_TYPE GcodeSuite::G29() {
refresh_bed_level();
#if ENABLED(ABL_BILINEAR_SUBDIVISION)
print_bilinear_leveling_grid_virt();
#endif
TERN_(ABL_BILINEAR_SUBDIVISION, print_bilinear_leveling_grid_virt());
#elif ENABLED(AUTO_BED_LEVELING_LINEAR)

View File

@ -55,12 +55,8 @@ void GcodeSuite::M421() {
SERIAL_ERROR_MSG(STR_ERR_MESH_XY);
else {
z_values[ix][iy] = parser.value_linear_units() + (hasQ ? z_values[ix][iy] : 0);
#if ENABLED(ABL_BILINEAR_SUBDIVISION)
bed_level_virt_interpolate();
#endif
#if ENABLED(EXTENSIBLE_UI)
ExtUI::onMeshUpdate(ix, iy, z_values[ix][iy]);
#endif
TERN_(ABL_BILINEAR_SUBDIVISION, bed_level_virt_interpolate());
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(ix, iy, z_values[ix][iy]));
}
}

View File

@ -62,9 +62,7 @@ inline void echo_not_entered(const char c) { SERIAL_CHAR(c); SERIAL_ECHOLNPGM("
void GcodeSuite::G29() {
static int mbl_probe_index = -1;
#if HAS_SOFTWARE_ENDSTOPS
static bool saved_soft_endstops_state;
#endif
TERN_(HAS_SOFTWARE_ENDSTOPS, static bool saved_soft_endstops_state);
MeshLevelingState state = (MeshLevelingState)parser.byteval('S', (int8_t)MeshReport);
if (!WITHIN(state, 0, 5)) {
@ -111,9 +109,7 @@ void GcodeSuite::G29() {
else {
// Save Z for the previous mesh position
mbl.set_zigzag_z(mbl_probe_index - 1, current_position.z);
#if HAS_SOFTWARE_ENDSTOPS
soft_endstops_enabled = saved_soft_endstops_state;
#endif
TERN_(HAS_SOFTWARE_ENDSTOPS, soft_endstops_enabled = saved_soft_endstops_state);
}
// If there's another point to sample, move there with optional lift.
if (mbl_probe_index < GRID_MAX_POINTS) {
@ -147,9 +143,7 @@ void GcodeSuite::G29() {
planner.synchronize();
#endif
#if ENABLED(LCD_BED_LEVELING)
ui.wait_for_move = false;
#endif
TERN_(LCD_BED_LEVELING, ui.wait_for_move = false);
}
break;
@ -178,9 +172,7 @@ void GcodeSuite::G29() {
if (parser.seenval('Z')) {
mbl.z_values[ix][iy] = parser.value_linear_units();
#if ENABLED(EXTENSIBLE_UI)
ExtUI::onMeshUpdate(ix, iy, mbl.z_values[ix][iy]);
#endif
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(ix, iy, mbl.z_values[ix][iy]));
}
else
return echo_not_entered('Z');

View File

@ -63,9 +63,7 @@ void GcodeSuite::M421() {
else {
float &zval = ubl.z_values[ij.x][ij.y];
zval = hasN ? NAN : parser.value_linear_units() + (hasQ ? zval : 0);
#if ENABLED(EXTENSIBLE_UI)
ExtUI::onMeshUpdate(ij.x, ij.y, zval);
#endif
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(ij.x, ij.y, zval));
}
}

View File

@ -126,22 +126,16 @@
*/
destination.set(safe_homing_xy, current_position.z);
#if HOMING_Z_WITH_PROBE
destination -= probe.offset_xy;
#endif
TERN_(HOMING_Z_WITH_PROBE, destination -= probe.offset_xy);
if (position_is_reachable(destination)) {
if (DEBUGGING(LEVELING)) DEBUG_POS("home_z_safely", destination);
// This causes the carriage on Dual X to unpark
#if ENABLED(DUAL_X_CARRIAGE)
active_extruder_parked = false;
#endif
TERN_(DUAL_X_CARRIAGE, active_extruder_parked = false);
#if ENABLED(SENSORLESS_HOMING)
safe_delay(500); // Short delay needed to settle
#endif
TERN_(SENSORLESS_HOMING, safe_delay(500)); // Short delay needed to settle
do_blocking_move_to_xy(destination);
homeaxis(Z_AXIS);
@ -175,9 +169,7 @@
void end_slow_homing(const slow_homing_t &slow_homing) {
planner.settings.max_acceleration_mm_per_s2[X_AXIS] = slow_homing.acceleration.x;
planner.settings.max_acceleration_mm_per_s2[Y_AXIS] = slow_homing.acceleration.y;
#if HAS_CLASSIC_JERK
planner.max_jerk = slow_homing.jerk_xy;
#endif
TERN_(HAS_CLASSIC_JERK, planner.max_jerk = slow_homing.jerk_xy);
planner.reset_acceleration_rates();
}
@ -237,22 +229,18 @@ void GcodeSuite::G28() {
#if HAS_LEVELING
// Cancel the active G29 session
#if ENABLED(PROBE_MANUALLY)
g29_in_progress = false;
#endif
TERN_(PROBE_MANUALLY, g29_in_progress = false);
#if ENABLED(RESTORE_LEVELING_AFTER_G28)
const bool leveling_was_active = planner.leveling_active;
#endif
TERN_(RESTORE_LEVELING_AFTER_G28, const bool leveling_was_active = planner.leveling_active);
set_bed_leveling_enabled(false);
#endif
#if ENABLED(CNC_WORKSPACE_PLANES)
workspace_plane = PLANE_XY;
#endif
TERN_(CNC_WORKSPACE_PLANES, workspace_plane = PLANE_XY);
#define HAS_CURRENT_HOME(N) (defined(N##_CURRENT_HOME) && N##_CURRENT_HOME != N##_CURRENT)
#define HAS_HOMING_CURRENT (HAS_CURRENT_HOME(X) || HAS_CURRENT_HOME(X2) || HAS_CURRENT_HOME(Y) || HAS_CURRENT_HOME(Y2))
#if HAS_CURRENT_HOME(X) || HAS_CURRENT_HOME(X2) || HAS_CURRENT_HOME(Y) || HAS_CURRENT_HOME(Y2)
#define HAS_HOMING_CURRENT 1
#endif
#if HAS_HOMING_CURRENT
auto debug_current = [](PGM_P const s, const int16_t a, const int16_t b){
@ -280,9 +268,7 @@ void GcodeSuite::G28() {
#endif
#endif
#if ENABLED(IMPROVE_HOMING_RELIABILITY)
slow_homing_t slow_homing = begin_slow_homing();
#endif
TERN_(IMPROVE_HOMING_RELIABILITY, slow_homing_t slow_homing = begin_slow_homing());
// Always home with tool 0 active
#if HAS_MULTI_HOTEND
@ -292,9 +278,7 @@ void GcodeSuite::G28() {
tool_change(0, true);
#endif
#if HAS_DUPLICATION_MODE
extruder_duplication_enabled = false;
#endif
TERN_(HAS_DUPLICATION_MODE, extruder_duplication_enabled = false);
remember_feedrate_scaling_off();
@ -306,9 +290,7 @@ void GcodeSuite::G28() {
home_delta();
#if ENABLED(IMPROVE_HOMING_RELIABILITY)
end_slow_homing(slow_homing);
#endif
TERN_(IMPROVE_HOMING_RELIABILITY, end_slow_homing(slow_homing));
#else // NOT DELTA
@ -380,17 +362,13 @@ void GcodeSuite::G28() {
if (DISABLED(HOME_Y_BEFORE_X) && doY)
homeaxis(Y_AXIS);
#if ENABLED(IMPROVE_HOMING_RELIABILITY)
end_slow_homing(slow_homing);
#endif
TERN_(IMPROVE_HOMING_RELIABILITY, end_slow_homing(slow_homing));
// Home Z last if homing towards the bed
#if Z_HOME_DIR < 0
if (doZ) {
#if ENABLED(BLTOUCH)
bltouch.init();
#endif
TERN_(BLTOUCH, bltouch.init());
#if ENABLED(Z_SAFE_HOMING)
home_z_safely();
#else
@ -425,9 +403,7 @@ void GcodeSuite::G28() {
if (dxc_is_duplicating()) {
#if ENABLED(IMPROVE_HOMING_RELIABILITY)
slow_homing = begin_slow_homing();
#endif
TERN_(IMPROVE_HOMING_RELIABILITY, slow_homing = begin_slow_homing());
// Always home the 2nd (right) extruder first
active_extruder = 1;
@ -448,9 +424,7 @@ void GcodeSuite::G28() {
dual_x_carriage_mode = IDEX_saved_mode;
stepper.set_directions();
#if ENABLED(IMPROVE_HOMING_RELIABILITY)
end_slow_homing(slow_homing);
#endif
TERN_(IMPROVE_HOMING_RELIABILITY, end_slow_homing(slow_homing));
}
#endif // DUAL_X_CARRIAGE
@ -458,18 +432,14 @@ void GcodeSuite::G28() {
endstops.not_homing();
// Clear endstop state for polled stallGuard endstops
#if ENABLED(SPI_ENDSTOPS)
endstops.clear_endstop_state();
#endif
TERN_(SPI_ENDSTOPS, endstops.clear_endstop_state());
#if BOTH(DELTA, DELTA_HOME_TO_SAFE_ZONE)
// move to a height where we can use the full xy-area
do_blocking_move_to_z(delta_clip_start_height);
#endif
#if ENABLED(RESTORE_LEVELING_AFTER_G28)
set_bed_leveling_enabled(leveling_was_active);
#endif
TERN_(RESTORE_LEVELING_AFTER_G28, set_bed_leveling_enabled(leveling_was_active));
restore_feedrate_and_scaling();

View File

@ -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

View File

@ -113,15 +113,11 @@ void GcodeSuite::G34() {
// Disable the leveling matrix before auto-aligning
#if HAS_LEVELING
#if ENABLED(RESTORE_LEVELING_AFTER_G34)
const bool leveling_was_active = planner.leveling_active;
#endif
TERN_(RESTORE_LEVELING_AFTER_G34, const bool leveling_was_active = planner.leveling_active);
set_bed_leveling_enabled(false);
#endif
#if ENABLED(CNC_WORKSPACE_PLANES)
workspace_plane = PLANE_XY;
#endif
TERN_(CNC_WORKSPACE_PLANES, workspace_plane = PLANE_XY);
// Always home with tool 0 active
#if HAS_MULTI_HOTEND
@ -129,18 +125,12 @@ void GcodeSuite::G34() {
tool_change(0, true);
#endif
#if HAS_DUPLICATION_MODE
extruder_duplication_enabled = false;
#endif
TERN_(HAS_DUPLICATION_MODE, extruder_duplication_enabled = false);
#if BOTH(BLTOUCH, BLTOUCH_HS_MODE)
// In BLTOUCH HS mode, the probe travels in a deployed state.
// Users of G34 might have a badly misaligned bed, so raise Z by the
// length of the deployed pin (BLTOUCH stroke < 7mm)
#define Z_BASIC_CLEARANCE Z_CLEARANCE_BETWEEN_PROBES + 7.0f
#else
#define Z_BASIC_CLEARANCE Z_CLEARANCE_BETWEEN_PROBES
#endif
// In BLTOUCH HS mode, the probe travels in a deployed state.
// Users of G34 might have a badly misaligned bed, so raise Z by the
// length of the deployed pin (BLTOUCH stroke < 7mm)
#define Z_BASIC_CLEARANCE Z_CLEARANCE_BETWEEN_PROBES + 7.0f * BOTH(BLTOUCH, BLTOUCH_HS_MODE)
// Compute a worst-case clearance height to probe from. After the first
// iteration this will be re-calculated based on the actual bed position
@ -386,9 +376,7 @@ void GcodeSuite::G34() {
#endif
// Restore the active tool after homing
#if HAS_MULTI_HOTEND
tool_change(old_tool_index, DISABLED(PARKING_EXTRUDER)); // Fetch previous tool for parking extruder
#endif
TERN_(HAS_MULTI_HOTEND, tool_change(old_tool_index, DISABLED(PARKING_EXTRUDER))); // Fetch previous tool for parking extruder
#if HAS_LEVELING && ENABLED(RESTORE_LEVELING_AFTER_G34)
set_bed_leveling_enabled(leveling_was_active);

View File

@ -285,37 +285,19 @@ inline void probe_sides(measurements_t &m, const float uncertainty) {
probe_side(m, uncertainty, TOP);
#endif
#if ENABLED(CALIBRATION_MEASURE_RIGHT)
probe_side(m, uncertainty, RIGHT, probe_top_at_edge);
#endif
#if ENABLED(CALIBRATION_MEASURE_FRONT)
probe_side(m, uncertainty, FRONT, probe_top_at_edge);
#endif
#if ENABLED(CALIBRATION_MEASURE_LEFT)
probe_side(m, uncertainty, LEFT, probe_top_at_edge);
#endif
#if ENABLED(CALIBRATION_MEASURE_BACK)
probe_side(m, uncertainty, BACK, probe_top_at_edge);
#endif
TERN_(CALIBRATION_MEASURE_RIGHT, probe_side(m, uncertainty, RIGHT, probe_top_at_edge));
TERN_(CALIBRATION_MEASURE_FRONT, probe_side(m, uncertainty, FRONT, probe_top_at_edge));
TERN_(CALIBRATION_MEASURE_LEFT, probe_side(m, uncertainty, LEFT, probe_top_at_edge));
TERN_(CALIBRATION_MEASURE_BACK, probe_side(m, uncertainty, BACK, probe_top_at_edge));
// Compute the measured center of the calibration object.
#if HAS_X_CENTER
m.obj_center.x = (m.obj_side[LEFT] + m.obj_side[RIGHT]) / 2;
#endif
#if HAS_Y_CENTER
m.obj_center.y = (m.obj_side[FRONT] + m.obj_side[BACK]) / 2;
#endif
TERN_(HAS_X_CENTER, m.obj_center.x = (m.obj_side[LEFT] + m.obj_side[RIGHT]) / 2);
TERN_(HAS_Y_CENTER, m.obj_center.y = (m.obj_side[FRONT] + m.obj_side[BACK]) / 2);
// Compute the outside diameter of the nozzle at the height
// at which it makes contact with the calibration object
#if HAS_X_CENTER
m.nozzle_outer_dimension.x = m.obj_side[RIGHT] - m.obj_side[LEFT] - dimensions.x;
#endif
#if HAS_Y_CENTER
m.nozzle_outer_dimension.y = m.obj_side[BACK] - m.obj_side[FRONT] - dimensions.y;
#endif
TERN_(HAS_X_CENTER, m.nozzle_outer_dimension.x = m.obj_side[RIGHT] - m.obj_side[LEFT] - dimensions.x);
TERN_(HAS_Y_CENTER, m.nozzle_outer_dimension.y = m.obj_side[BACK] - m.obj_side[FRONT] - dimensions.y);
park_above_object(m, uncertainty);
@ -544,13 +526,9 @@ inline void calibrate_all_toolheads(measurements_t &m, const float uncertainty)
HOTEND_LOOP() calibrate_toolhead(m, uncertainty, e);
#if HAS_HOTEND_OFFSET
normalize_hotend_offsets();
#endif
TERN_(HAS_HOTEND_OFFSET, normalize_hotend_offsets());
#if HAS_MULTI_HOTEND
set_nozzle(m, 0);
#endif
TERN_(HAS_MULTI_HOTEND, set_nozzle(m, 0));
}
/**
@ -567,9 +545,7 @@ inline void calibrate_all_toolheads(measurements_t &m, const float uncertainty)
inline void calibrate_all() {
measurements_t m;
#if HAS_HOTEND_OFFSET
reset_hotend_offsets();
#endif
TERN_(HAS_HOTEND_OFFSET, reset_hotend_offsets());
TEMPORARY_BACKLASH_CORRECTION(all_on);
TEMPORARY_BACKLASH_SMOOTHING(0.0f);
@ -577,9 +553,7 @@ inline void calibrate_all() {
// Do a fast and rough calibration of the toolheads
calibrate_all_toolheads(m, CALIBRATION_MEASUREMENT_UNKNOWN);
#if ENABLED(BACKLASH_GCODE)
calibrate_backlash(m, CALIBRATION_MEASUREMENT_UNCERTAIN);
#endif
TERN_(BACKLASH_GCODE, calibrate_backlash(m, CALIBRATION_MEASUREMENT_UNCERTAIN));
// Cycle the toolheads so the servos settle into their "natural" positions
#if HAS_MULTI_HOTEND

View File

@ -178,9 +178,7 @@ void GcodeSuite::G76() {
report_temps(next_temp_report);
// Disable leveling so it won't mess with us
#if HAS_LEVELING
set_bed_leveling_enabled(false);
#endif
TERN_(HAS_LEVELING, set_bed_leveling_enabled(false));
for (;;) {
thermalManager.setTargetBed(target_bed);
@ -214,9 +212,7 @@ void GcodeSuite::G76() {
// Cleanup
thermalManager.setTargetBed(0);
#if HAS_LEVELING
set_bed_leveling_enabled(true);
#endif
TERN_(HAS_LEVELING, set_bed_leveling_enabled(true));
} // do_bed_cal
/********************************************
@ -240,9 +236,7 @@ void GcodeSuite::G76() {
wait_for_temps(target_bed, target_probe, next_temp_report);
// Disable leveling so it won't mess with us
#if HAS_LEVELING
set_bed_leveling_enabled(false);
#endif
TERN_(HAS_LEVELING, set_bed_leveling_enabled(false));
bool timeout = false;
for (;;) {
@ -273,9 +267,7 @@ void GcodeSuite::G76() {
// Cleanup
thermalManager.setTargetBed(0);
#if HAS_LEVELING
set_bed_leveling_enabled(true);
#endif
TERN_(HAS_LEVELING, set_bed_leveling_enabled(true));
SERIAL_ECHOLNPGM("Final compensation values:");
temp_comp.print_offsets();

View File

@ -263,9 +263,7 @@ void GcodeSuite::M48() {
restore_feedrate_and_scaling();
// Re-enable bed level correction if it had been on
#if HAS_LEVELING
set_bed_leveling_enabled(was_enabled);
#endif
TERN_(HAS_LEVELING, set_bed_leveling_enabled(was_enabled));
report_current_position();
}

View File

@ -142,9 +142,7 @@ void GcodeSuite::M205() {
const float junc_dev = parser.value_linear_units();
if (WITHIN(junc_dev, 0.01f, 0.3f)) {
planner.junction_deviation_mm = junc_dev;
#if ENABLED(LIN_ADVANCE)
planner.recalculate_max_e_jerk();
#endif
TERN_(LIN_ADVANCE, planner.recalculate_max_e_jerk());
}
else
SERIAL_ERROR_MSG("?J out of range (0.01 to 0.3)");

View File

@ -340,12 +340,8 @@ void GcodeSuite::M43() {
#if HAS_RESUME_CONTINUE
KEEPALIVE_STATE(PAUSED_FOR_USER);
wait_for_user = true;
#if ENABLED(HOST_PROMPT_SUPPORT)
host_prompt_do(PROMPT_USER_CONTINUE, PSTR("M43 Wait Called"), CONTINUE_STR);
#endif
#if ENABLED(EXTENSIBLE_UI)
ExtUI::onUserConfirmRequired_P(PSTR("M43 Wait Called"));
#endif
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, PSTR("M43 Wait Called"), CONTINUE_STR));
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(PSTR("M43 Wait Called")));
#endif
for (;;) {
@ -366,9 +362,7 @@ void GcodeSuite::M43() {
}
}
#if HAS_RESUME_CONTINUE
if (!wait_for_user) break;
#endif
if (TERN0(HAS_RESUME_CONTINUE, !wait_for_user)) break;
safe_delay(200);
}

View File

@ -31,9 +31,7 @@
* M108: Stop the waiting for heaters in M109, M190, M303. Does not affect the target temperature.
*/
void GcodeSuite::M108() {
#if HAS_RESUME_CONTINUE
wait_for_user = false;
#endif
TERN_(HAS_RESUME_CONTINUE, wait_for_user = false);
wait_for_heatup = false;
}

View File

@ -37,9 +37,7 @@ void GcodeSuite::M17() {
if (parser.seen('X')) ENABLE_AXIS_X();
if (parser.seen('Y')) ENABLE_AXIS_Y();
if (parser.seen('Z')) ENABLE_AXIS_Z();
#if HAS_E_STEPPER_ENABLE
if (parser.seen('E')) enable_e_steppers();
#endif
if (TERN0(HAS_E_STEPPER_ENABLE, parser.seen('E'))) enable_e_steppers();
}
else {
LCD_MESSAGEPGM(MSG_NO_MOVE);
@ -60,9 +58,7 @@ void GcodeSuite::M18_M84() {
if (parser.seen('X')) DISABLE_AXIS_X();
if (parser.seen('Y')) DISABLE_AXIS_Y();
if (parser.seen('Z')) DISABLE_AXIS_Z();
#if HAS_E_STEPPER_ENABLE
if (parser.seen('E')) disable_e_steppers();
#endif
if (TERN0(HAS_E_STEPPER_ENABLE, parser.seen('E'))) disable_e_steppers();
}
else
planner.finish_and_disable();

View File

@ -86,12 +86,8 @@ void GcodeSuite::M907() {
* M908: Control digital trimpot directly (M908 P<pin> S<current>)
*/
void GcodeSuite::M908() {
#if HAS_DIGIPOTSS
stepper.digitalPotWrite(parser.intval('P'), parser.intval('S'));
#endif
#if ENABLED(DAC_STEPPER_CURRENT)
dac_current_raw(parser.byteval('P', -1), parser.ushortval('S', 0));
#endif
TERN_(HAS_DIGIPOTSS, stepper.digitalPotWrite(parser.intval('P'), parser.intval('S')));
TERN_(DAC_STEPPER_CURRENT, dac_current_raw(parser.byteval('P', -1), parser.ushortval('S', 0)));
}
#endif // HAS_DIGIPOTSS || DAC_STEPPER_CURRENT

View File

@ -56,11 +56,7 @@
*/
void GcodeSuite::M125() {
// Initial retract before move to filament change position
const float retract = -ABS(parser.seen('L') ? parser.value_axis_units(E_AXIS) : 0
#ifdef PAUSE_PARK_RETRACT_LENGTH
+ (PAUSE_PARK_RETRACT_LENGTH)
#endif
);
const float retract = -ABS(parser.seen('L') ? parser.value_axis_units(E_AXIS) : (PAUSE_PARK_RETRACT_LENGTH));
xyz_pos_t park_point = NOZZLE_PARK_POINT;
@ -75,23 +71,14 @@ void GcodeSuite::M125() {
park_point += hotend_offset[active_extruder];
#endif
#if ENABLED(SDSUPPORT)
const bool sd_printing = IS_SD_PRINTING();
#else
constexpr bool sd_printing = false;
#endif
const bool sd_printing = TERN0(SDSUPPORT, IS_SD_PRINTING());
#if HAS_LCD_MENU
lcd_pause_show_message(PAUSE_MESSAGE_PARKING, PAUSE_MODE_PAUSE_PRINT);
const bool show_lcd = parser.seenval('P');
#else
constexpr bool show_lcd = false;
#endif
TERN_(HAS_LCD_MENU, lcd_pause_show_message(PAUSE_MESSAGE_PARKING, PAUSE_MODE_PAUSE_PRINT));
const bool show_lcd = TERN0(HAS_LCD_MENU, parser.seenval('P'));
if (pause_print(retract, park_point, 0, show_lcd)) {
#if ENABLED(POWER_LOSS_RECOVERY)
if (recovery.enabled) recovery.save(true);
#endif
TERN_(POWER_LOSS_RECOVERY, if (recovery.enabled) recovery.save(true));
if (!sd_printing || show_lcd) {
wait_for_confirmation(false, 0);
resume_print(0, 0, -retract, 0);

View File

@ -112,11 +112,7 @@ void GcodeSuite::M600() {
#endif
// Initial retract before move to filament change position
const float retract = -ABS(parser.seen('E') ? parser.value_axis_units(E_AXIS) : 0
#ifdef PAUSE_PARK_RETRACT_LENGTH
+ (PAUSE_PARK_RETRACT_LENGTH)
#endif
);
const float retract = -ABS(parser.seen('E') ? parser.value_axis_units(E_AXIS) : (PAUSE_PARK_RETRACT_LENGTH));
xyz_pos_t park_point NOZZLE_PARK_POINT;
@ -149,11 +145,9 @@ void GcodeSuite::M600() {
: fc_settings[active_extruder].load_length);
#endif
const int beep_count = parser.intval('B',
const int beep_count = parser.intval('B', -1
#ifdef FILAMENT_CHANGE_ALERT_BEEPS
FILAMENT_CHANGE_ALERT_BEEPS
#else
-1
+ 1 + FILAMENT_CHANGE_ALERT_BEEPS
#endif
);
@ -173,9 +167,7 @@ void GcodeSuite::M600() {
tool_change(active_extruder_before_filament_change, false);
#endif
#if ENABLED(MIXING_EXTRUDER)
mixer.T(old_mixing_tool); // Restore original mixing tool
#endif
TERN_(MIXING_EXTRUDER, mixer.T(old_mixing_tool)); // Restore original mixing tool
}
#endif // ADVANCED_PAUSE_FEATURE

View File

@ -84,9 +84,7 @@ void GcodeSuite::M701() {
if (parser.seenval('Z')) park_point.z = parser.linearval('Z');
// Show initial "wait for load" message
#if HAS_LCD_MENU
lcd_pause_show_message(PAUSE_MESSAGE_LOAD, PAUSE_MODE_LOAD_FILAMENT, target_extruder);
#endif
TERN_(HAS_LCD_MENU, lcd_pause_show_message(PAUSE_MESSAGE_LOAD, PAUSE_MODE_LOAD_FILAMENT, target_extruder));
#if EXTRUDERS > 1 && DISABLED(PRUSA_MMU2)
// Change toolhead if specified
@ -129,14 +127,10 @@ void GcodeSuite::M701() {
tool_change(active_extruder_before_filament_change, false);
#endif
#if ENABLED(MIXING_EXTRUDER)
mixer.T(old_mixing_tool); // Restore original mixing tool
#endif
TERN_(MIXING_EXTRUDER, mixer.T(old_mixing_tool)); // Restore original mixing tool
// Show status screen
#if HAS_LCD_MENU
lcd_pause_show_message(PAUSE_MESSAGE_STATUS);
#endif
TERN_(HAS_LCD_MENU, lcd_pause_show_message(PAUSE_MESSAGE_STATUS));
}
/**
@ -190,9 +184,7 @@ void GcodeSuite::M702() {
if (parser.seenval('Z')) park_point.z = parser.linearval('Z');
// Show initial "wait for unload" message
#if HAS_LCD_MENU
lcd_pause_show_message(PAUSE_MESSAGE_UNLOAD, PAUSE_MODE_UNLOAD_FILAMENT, target_extruder);
#endif
TERN_(HAS_LCD_MENU, lcd_pause_show_message(PAUSE_MESSAGE_UNLOAD, PAUSE_MODE_UNLOAD_FILAMENT, target_extruder));
#if EXTRUDERS > 1 && DISABLED(PRUSA_MMU2)
// Change toolhead if specified
@ -241,14 +233,10 @@ void GcodeSuite::M702() {
tool_change(active_extruder_before_filament_change, false);
#endif
#if ENABLED(MIXING_EXTRUDER)
mixer.T(old_mixing_tool); // Restore original mixing tool
#endif
TERN_(MIXING_EXTRUDER, mixer.T(old_mixing_tool)); // Restore original mixing tool
// Show status screen
#if HAS_LCD_MENU
lcd_pause_show_message(PAUSE_MESSAGE_STATUS);
#endif
TERN_(HAS_LCD_MENU, lcd_pause_show_message(PAUSE_MESSAGE_STATUS));
}
#endif // ADVANCED_PAUSE_FEATURE

View File

@ -74,9 +74,7 @@ void GcodeSuite::M1000() {
#else
recovery.cancel();
#endif
#if ENABLED(EXTENSIBLE_UI)
ExtUI::onPrintTimerStopped();
#endif
TERN_(EXTENSIBLE_UI, ExtUI::onPrintTimerStopped());
}
else
recovery.resume();

View File

@ -218,9 +218,7 @@ void GcodeSuite::dwell(millis_t time) {
}
}
#if ENABLED(HOST_PROMPT_SUPPORT)
host_action_prompt_end();
#endif
TERN_(HOST_PROMPT_SUPPORT, host_action_prompt_end());
#ifdef G29_SUCCESS_COMMANDS
process_subcommands_now_P(PSTR(G29_SUCCESS_COMMANDS));

View File

@ -396,24 +396,18 @@ private:
#endif
);
#if ENABLED(ARC_SUPPORT)
static void G2_G3(const bool clockwise);
#endif
TERN_(ARC_SUPPORT, static void G2_G3(const bool clockwise));
static void G4();
#if ENABLED(BEZIER_CURVE_SUPPORT)
static void G5();
#endif
TERN_(BEZIER_CURVE_SUPPORT, static void G5());
#if ENABLED(FWRETRACT)
static void G10();
static void G11();
#endif
#if ENABLED(NOZZLE_CLEAN_FEATURE)
static void G12();
#endif
TERN_(NOZZLE_CLEAN_FEATURE, static void G12());
#if ENABLED(CNC_WORKSPACE_PLANES)
static void G17();
@ -426,13 +420,9 @@ private:
static void G21();
#endif
#if ENABLED(G26_MESH_VALIDATION)
static void G26();
#endif
TERN_(G26_MESH_VALIDATION, static void G26());
#if ENABLED(NOZZLE_PARK_FEATURE)
static void G27();
#endif
TERN_(NOZZLE_PARK_FEATURE, static void G27());
static void G28();
@ -454,22 +444,16 @@ private:
#endif
#endif
#if ENABLED(DELTA_AUTO_CALIBRATION)
static void G33();
#endif
TERN_(DELTA_AUTO_CALIBRATION, static void G33());
#if ENABLED(Z_STEPPER_AUTO_ALIGN)
static void G34();
static void M422();
#endif
#if ENABLED(G38_PROBE_TARGET)
static void G38(const int8_t subcode);
#endif
TERN_(G38_PROBE_TARGET, static void G38(const int8_t subcode));
#if HAS_MESH
static void G42();
#endif
TERN_(HAS_MESH, static void G42());
#if ENABLED(CNC_COORDINATE_SYSTEMS)
static void G53();
@ -481,28 +465,20 @@ private:
static void G59();
#endif
#if ENABLED(PROBE_TEMP_COMPENSATION)
static void G76();
#endif
TERN_(PROBE_TEMP_COMPENSATION, static void G76());
#if SAVED_POSITIONS
static void G60();
static void G61();
#endif
#if ENABLED(GCODE_MOTION_MODES)
static void G80();
#endif
TERN_(GCODE_MOTION_MODES, static void G80());
static void G92();
#if ENABLED(CALIBRATION_GCODE)
static void G425();
#endif
TERN_(CALIBRATION_GCODE, static void G425());
#if HAS_RESUME_CONTINUE
static void M0_M1();
#endif
TERN_(HAS_RESUME_CONTINUE, static void M0_M1());
#if HAS_CUTTER
static void M3_M4(const bool is_M4);
@ -510,22 +486,14 @@ private:
#endif
#if ENABLED(COOLANT_CONTROL)
#if ENABLED(COOLANT_MIST)
static void M7();
#endif
#if ENABLED(COOLANT_FLOOD)
static void M8();
#endif
TERN_(COOLANT_MIST, static void M7());
TERN_(COOLANT_FLOOD, static void M8());
static void M9();
#endif
#if ENABLED(EXTERNAL_CLOSED_LOOP_CONTROLLER)
static void M12();
#endif
TERN_(EXTERNAL_CLOSED_LOOP_CONTROLLER, static void M12());
#if ENABLED(EXPECTED_PRINTER_CHECK)
static void M16();
#endif
TERN_(EXPECTED_PRINTER_CHECK, static void M16());
static void M17();
@ -549,9 +517,7 @@ private:
#if ENABLED(SDSUPPORT)
static void M32();
#if ENABLED(LONG_FILENAME_HOST_SUPPORT)
static void M33();
#endif
TERN_(LONG_FILENAME_HOST_SUPPORT, static void M33());
#if BOTH(SDCARD_SORT_ALPHA, SDSORT_GCODE)
static void M34();
#endif
@ -559,29 +525,19 @@ private:
static void M42();
#if ENABLED(PINS_DEBUGGING)
static void M43();
#endif
TERN_(PINS_DEBUGGING, static void M43());
#if ENABLED(Z_MIN_PROBE_REPEATABILITY_TEST)
static void M48();
#endif
TERN_(Z_MIN_PROBE_REPEATABILITY_TEST, static void M48());
#if ENABLED(LCD_SET_PROGRESS_MANUALLY)
static void M73();
#endif
TERN_(LCD_SET_PROGRESS_MANUALLY, static void M73());
static void M75();
static void M76();
static void M77();
#if ENABLED(PRINTCOUNTER)
static void M78();
#endif
TERN_(PRINTCOUNTER, static void M78());
#if ENABLED(PSU_CONTROL)
static void M80();
#endif
TERN_(PSU_CONTROL, static void M80());
static void M81();
static void M82();
@ -589,9 +545,7 @@ private:
static void M85();
static void M92();
#if ENABLED(M100_FREE_MEMORY_WATCHER)
static void M100();
#endif
TERN_(M100_FREE_MEMORY_WATCHER, static void M100());
#if EXTRUDERS
static void M104();
@ -609,17 +563,13 @@ private:
static void M108();
static void M112();
static void M410();
#if ENABLED(HOST_PROMPT_SUPPORT)
static void M876();
#endif
TERN_(HOST_PROMPT_SUPPORT, static void M876());
#endif
static void M110();
static void M111();
#if ENABLED(HOST_KEEPALIVE_FEATURE)
static void M113();
#endif
TERN_(HOST_KEEPALIVE_FEATURE, static void M113());
static void M114();
static void M115();
@ -629,9 +579,7 @@ private:
static void M120();
static void M121();
#if ENABLED(PARK_HEAD_ON_PAUSE)
static void M125();
#endif
TERN_(PARK_HEAD_ON_PAUSE, static void M125());
#if ENABLED(BARICUDA)
#if HAS_HEATER_1
@ -658,13 +606,9 @@ private:
static void M145();
#endif
#if ENABLED(TEMPERATURE_UNITS_SUPPORT)
static void M149();
#endif
TERN_(TEMPERATURE_UNITS_SUPPORT, static void M149());
#if HAS_COLOR_LEDS
static void M150();
#endif
TERN_(HAS_COLOR_LEDS, static void M150());
#if ENABLED(AUTO_REPORT_TEMPERATURES) && HAS_TEMP_SENSOR
static void M155();
@ -673,12 +617,8 @@ private:
#if ENABLED(MIXING_EXTRUDER)
static void M163();
static void M164();
#if ENABLED(DIRECT_MIXING_IN_G1)
static void M165();
#endif
#if ENABLED(GRADIENT_MIX)
static void M166();
#endif
TERN_(DIRECT_MIXING_IN_G1, static void M165());
TERN_(GRADIENT_MIX, static void M166());
#endif
static void M200();
@ -692,16 +632,12 @@ private:
static void M204();
static void M205();
#if HAS_M206_COMMAND
static void M206();
#endif
TERN_(HAS_M206_COMMAND, static void M206());
#if ENABLED(FWRETRACT)
static void M207();
static void M208();
#if ENABLED(FWRETRACT_AUTORETRACT)
static void M209();
#endif
TERN_(FWRETRACT_AUTORETRACT, static void M209());
#endif
static void M211();
@ -710,9 +646,7 @@ private:
static void M217();
#endif
#if HAS_HOTEND_OFFSET
static void M218();
#endif
TERN_(HAS_HOTEND_OFFSET, static void M218());
static void M220();
@ -722,13 +656,9 @@ private:
static void M226();
#if ENABLED(PHOTO_GCODE)
static void M240();
#endif
TERN_(PHOTO_GCODE, static void M240());
#if HAS_LCD_CONTRAST
static void M250();
#endif
TERN_(HAS_LCD_CONTRAST, static void M250());
#if ENABLED(EXPERIMENTAL_I2CBUS)
static void M260();
@ -737,47 +667,29 @@ private:
#if HAS_SERVOS
static void M280();
#if ENABLED(EDITABLE_SERVO_ANGLES)
static void M281();
#endif
TERN_(EDITABLE_SERVO_ANGLES, static void M281());
#endif
#if ENABLED(BABYSTEPPING)
static void M290();
#endif
TERN_(BABYSTEPPING, static void M290());
#if HAS_BUZZER
static void M300();
#endif
TERN_(HAS_BUZZER, static void M300());
#if ENABLED(PIDTEMP)
static void M301();
#endif
TERN_(PIDTEMP, static void M301());
#if ENABLED(PREVENT_COLD_EXTRUSION)
static void M302();
#endif
TERN_(PREVENT_COLD_EXTRUSION, static void M302());
#if HAS_PID_HEATING
static void M303();
#endif
TERN_(HAS_PID_HEATING, static void M303());
#if ENABLED(PIDTEMPBED)
static void M304();
#endif
TERN_(PIDTEMPBED, static void M304());
#if HAS_USER_THERMISTORS
static void M305();
#endif
TERN_(HAS_USER_THERMISTORS, static void M305());
#if HAS_MICROSTEPS
static void M350();
static void M351();
#endif
#if HAS_CASE_LIGHT
static void M355();
#endif
TERN_(HAS_CASE_LIGHT, static void M355());
#if ENABLED(MORGAN_SCARA)
static bool M360();
@ -799,9 +711,7 @@ private:
static void M402();
#endif
#if ENABLED(PRUSA_MMU2)
static void M403();
#endif
TERN_(PRUSA_MMU2, static void M403());
#if ENABLED(FILAMENT_WIDTH_SENSOR)
static void M404();
@ -810,26 +720,18 @@ private:
static void M407();
#endif
#if HAS_FILAMENT_SENSOR
static void M412();
#endif
TERN_(HAS_FILAMENT_SENSOR, static void M412());
#if HAS_LEVELING
static void M420();
static void M421();
#endif
#if ENABLED(BACKLASH_GCODE)
static void M425();
#endif
TERN_(BACKLASH_GCODE, static void M425());
#if HAS_M206_COMMAND
static void M428();
#endif
TERN_(HAS_M206_COMMAND, static void M428());
#if ENABLED(CANCEL_OBJECTS)
static void M486();
#endif
TERN_(CANCEL_OBJECTS, static void M486());
static void M500();
static void M501();
@ -837,34 +739,22 @@ private:
#if DISABLED(DISABLE_M503)
static void M503();
#endif
#if ENABLED(EEPROM_SETTINGS)
static void M504();
#endif
TERN_(EEPROM_SETTINGS, static void M504());
#if ENABLED(SDSUPPORT)
static void M524();
#endif
TERN_(SDSUPPORT, static void M524());
#if ENABLED(SD_ABORT_ON_ENDSTOP_HIT)
static void M540();
#endif
TERN_(SD_ABORT_ON_ENDSTOP_HIT, static void M540());
#if ENABLED(BAUD_RATE_GCODE)
static void M575();
#endif
TERN_(BAUD_RATE_GCODE, static void M575());
#if ENABLED(ADVANCED_PAUSE_FEATURE)
static void M600();
static void M603();
#endif
#if HAS_DUPLICATION_MODE
static void M605();
#endif
TERN_(HAS_DUPLICATION_MODE, static void M605());
#if IS_KINEMATIC
static void M665();
#endif
TERN_(IS_KINEMATIC, static void M665());
#if ENABLED(DELTA) || HAS_EXTRA_ENDSTOPS
static void M666();
@ -879,17 +769,11 @@ private:
static void M702();
#endif
#if ENABLED(GCODE_MACROS)
static void M810_819();
#endif
TERN_(GCODE_MACROS, static void M810_819());
#if HAS_BED_PROBE
static void M851();
#endif
TERN_(HAS_BED_PROBE, static void M851());
#if ENABLED(SKEW_CORRECTION_GCODE)
static void M852();
#endif
TERN_(SKEW_CORRECTION_GCODE, static void M852());
#if ENABLED(I2C_POSITION_ENCODERS)
FORCE_INLINE static void M860() { I2CPEM.M860(); }
@ -904,30 +788,20 @@ private:
FORCE_INLINE static void M869() { I2CPEM.M869(); }
#endif
#if ENABLED(PROBE_TEMP_COMPENSATION)
static void M871();
#endif
TERN_(PROBE_TEMP_COMPENSATION, static void M871());
#if ENABLED(LIN_ADVANCE)
static void M900();
#endif
TERN_(LIN_ADVANCE, static void M900());
#if HAS_TRINAMIC_CONFIG
static void M122();
static void M906();
#if HAS_STEALTHCHOP
static void M569();
#endif
TERN_(HAS_STEALTHCHOP, static void M569());
#if ENABLED(MONITOR_DRIVER_STATUS)
static void M911();
static void M912();
#endif
#if ENABLED(HYBRID_THRESHOLD)
static void M913();
#endif
#if USE_SENSORLESS
static void M914();
#endif
TERN_(HYBRID_THRESHOLD, static void M913());
TERN_(USE_SENSORLESS, static void M914());
#endif
#if HAS_L64XX
@ -949,17 +823,11 @@ private:
#endif
#endif
#if ENABLED(SDSUPPORT)
static void M928();
#endif
TERN_(SDSUPPORT, static void M928());
#if ENABLED(MAGNETIC_PARKING_EXTRUDER)
static void M951();
#endif
TERN_(MAGNETIC_PARKING_EXTRUDER, static void M951());
#if ENABLED(PLATFORM_M997_SUPPORT)
static void M997();
#endif
TERN_(PLATFORM_M997_SUPPORT, static void M997());
static void M999();
@ -968,17 +836,11 @@ private:
static void M1000();
#endif
#if ENABLED(SDSUPPORT)
static void M1001();
#endif
TERN_(SDSUPPORT, static void M1001());
#if ENABLED(MAX7219_GCODE)
static void M7219();
#endif
TERN_(MAX7219_GCODE, static void M7219());
#if ENABLED(CONTROLLER_FAN_EDITABLE)
static void M710();
#endif
TERN_(CONTROLLER_FAN_EDITABLE, static void M710());
static void T(const uint8_t tool_index);

View File

@ -213,8 +213,6 @@ void GcodeSuite::M114() {
if (parser.seen('R')) { report_real_position(); return; }
#endif
#if ENABLED(M114_LEGACY)
planner.synchronize();
#endif
TERN_(M114_LEGACY, planner.synchronize());
report_current_position_projected();
}

View File

@ -44,14 +44,10 @@ void GcodeSuite::M115() {
#if ENABLED(EXTENDED_CAPABILITIES_REPORT)
// PAREN_COMMENTS
#if ENABLED(PAREN_COMMENTS)
cap_line(PSTR("PAREN_COMMENTS"), true);
#endif
TERN_(PAREN_COMMENTS, cap_line(PSTR("PAREN_COMMENTS"), true));
// QUOTED_STRINGS
#if ENABLED(GCODE_QUOTED_STRINGS)
cap_line(PSTR("QUOTED_STRINGS"), true);
#endif
TERN_(GCODE_QUOTED_STRINGS, cap_line(PSTR("QUOTED_STRINGS"), true));
// SERIAL_XON_XOFF
cap_line(PSTR("SERIAL_XON_XOFF"), ENABLED(SERIAL_XON_XOFF));
@ -92,7 +88,7 @@ void GcodeSuite::M115() {
// CASE LIGHTS (M355)
cap_line(PSTR("TOGGLE_LIGHTS"), ENABLED(HAS_CASE_LIGHT));
cap_line(PSTR("CASE_LIGHT_BRIGHTNESS"), TERN(HAS_CASE_LIGHT, PWM_PIN(CASE_LIGHT_PIN), 0));
cap_line(PSTR("CASE_LIGHT_BRIGHTNESS"), TERN0(HAS_CASE_LIGHT, PWM_PIN(CASE_LIGHT_PIN)));
// EMERGENCY_PARSER (M108, M112, M410, M876)
cap_line(PSTR("EMERGENCY_PARSER"), ENABLED(EMERGENCY_PARSER));

View File

@ -77,15 +77,11 @@ void GcodeSuite::M0_M1() {
#endif
#if ENABLED(HOST_PROMPT_SUPPORT)
host_prompt_do(PROMPT_USER_CONTINUE, parser.codenum ? PSTR("M1 Stop") : PSTR("M0 Stop"), CONTINUE_STR);
#endif
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, parser.codenum ? PSTR("M1 Stop") : PSTR("M0 Stop"), CONTINUE_STR));
wait_for_user_response(ms);
#if HAS_LCD_MENU
ui.reset_status();
#endif
TERN_(HAS_LCD_MENU, ui.reset_status());
}
#endif // HAS_RESUME_CONTINUE

View File

@ -70,14 +70,12 @@ void plan_arc(
ab_float_t rvec = -offset;
const float radius = HYPOT(rvec.a, rvec.b),
#if ENABLED(AUTO_BED_LEVELING_UBL)
start_L = current_position[l_axis],
#endif
center_P = current_position[p_axis] - rvec.a,
center_Q = current_position[q_axis] - rvec.b,
rt_X = cart[p_axis] - center_P,
rt_Y = cart[q_axis] - center_Q,
linear_travel = cart[l_axis] - current_position[l_axis],
start_L = current_position[l_axis],
linear_travel = cart[l_axis] - start_L,
extruder_travel = cart.e - current_position.e;
// CCW angle of rotation between position and target from the circle center. Only one atan2() trig computation required.
@ -157,7 +155,6 @@ void plan_arc(
// Initialize the extruder axis
raw.e = current_position.e;
#if ENABLED(SCARA_FEEDRATE_SCALING)
const float inv_duration = scaled_fr_mm_s / seg_length;
#endif
@ -220,15 +217,12 @@ void plan_arc(
#if ENABLED(SCARA_FEEDRATE_SCALING)
, inv_duration
#endif
))
break;
)) break;
}
// Ensure last segment arrives at target location.
raw = cart;
#if ENABLED(AUTO_BED_LEVELING_UBL)
raw[l_axis] = start_L;
#endif
TERN_(AUTO_BED_LEVELING_UBL, raw[l_axis] = start_L);
apply_motion_limits(raw);
@ -242,10 +236,9 @@ void plan_arc(
#endif
);
#if ENABLED(AUTO_BED_LEVELING_UBL)
raw[l_axis] = start_L;
#endif
TERN_(AUTO_BED_LEVELING_UBL, raw[l_axis] = start_L);
current_position = raw;
} // plan_arc
/**
@ -285,9 +278,7 @@ void GcodeSuite::G2_G3(const bool clockwise) {
get_destination_from_command(); // Get X Y Z E F (and set cutter power)
#if ENABLED(SF_ARC_FIX)
relative_mode = relative_mode_backup;
#endif
TERN_(SF_ARC_FIX, relative_mode = relative_mode_backup);
ab_float_t arc_offset = { 0, 0 };
if (parser.seenval('R')) {

View File

@ -83,9 +83,7 @@ void GCodeParser::reset() {
string_arg = nullptr; // No whole line argument
command_letter = '?'; // No command letter
codenum = 0; // No command code
#if ENABLED(USE_GCODE_SUBCODES)
subcode = 0; // No command sub-code
#endif
TERN_(USE_GCODE_SUBCODES, subcode = 0); // No command sub-code
#if ENABLED(FASTER_GCODE_PARSER)
codebits = 0; // No codes yet
//ZERO(param); // No parameters (should be safe to comment out this line)
@ -119,9 +117,8 @@ void GCodeParser::parse(char *p) {
reset(); // No codes to report
auto uppercase = [](char c) {
#if ENABLED(GCODE_CASE_INSENSITIVE)
if (WITHIN(c, 'a', 'z')) c += 'A' - 'a';
#endif
if (TERN0(GCODE_CASE_INSENSITIVE, WITHIN(c, 'a', 'z')))
c += 'A' - 'a';
return c;
};
@ -130,9 +127,7 @@ void GCodeParser::parse(char *p) {
// Skip N[-0-9] if included in the command line
if (uppercase(*p) == 'N' && NUMERIC_SIGNED(p[1])) {
#if ENABLED(FASTER_GCODE_PARSER)
//set('N', p + 1); // (optional) Set the 'N' parameter value
#endif
//TERN_(FASTER_GCODE_PARSER, set('N', p + 1)); // (optional) Set the 'N' parameter value
p += 2; // skip N[-0-9]
while (NUMERIC(*p)) ++p; // skip [0-9]*
while (*p == ' ') ++p; // skip [ ]*
@ -213,9 +208,7 @@ void GCodeParser::parse(char *p) {
)
) {
motion_mode_codenum = codenum;
#if ENABLED(USE_GCODE_SUBCODES)
motion_mode_subcode = subcode;
#endif
TERN_(USE_GCODE_SUBCODES, motion_mode_subcode = subcode);
}
#endif
@ -232,9 +225,7 @@ void GCodeParser::parse(char *p) {
if (motion_mode_codenum < 0) return;
command_letter = 'G';
codenum = motion_mode_codenum;
#if ENABLED(USE_GCODE_SUBCODES)
subcode = motion_mode_subcode;
#endif
TERN_(USE_GCODE_SUBCODES, subcode = motion_mode_subcode);
p--; // Back up one character to use the current parameter
break;
#endif // GCODE_MOTION_MODES
@ -331,13 +322,9 @@ void GCodeParser::parse(char *p) {
#endif
}
#if ENABLED(DEBUG_GCODE_PARSER)
if (debug) SERIAL_EOL();
#endif
if (TERN0(DEBUG_GCODE_PARSER, debug)) SERIAL_EOL();
#if ENABLED(FASTER_GCODE_PARSER)
set(param, valptr); // Set parameter exists and pointer (nullptr for no value)
#endif
TERN_(FASTER_GCODE_PARSER, set(param, valptr)); // Set parameter exists and pointer (nullptr for no value)
}
else if (!string_arg) { // Not A-Z? First time, keep as the string_arg
string_arg = p - 1;

View File

@ -46,9 +46,7 @@ void GcodeSuite::G30() {
if (!probe.can_reach(pos)) return;
// Disable leveling so the planner won't mess with us
#if HAS_LEVELING
set_bed_leveling_enabled(false);
#endif
TERN_(HAS_LEVELING, set_bed_leveling_enabled(false));
remember_feedrate_scaling_off();

View File

@ -46,9 +46,7 @@ void mpe_settings_init() {
mpe_settings.parking_xpos[0] = pex[0]; // M951 L
mpe_settings.parking_xpos[1] = pex[1]; // M951 R
mpe_settings.grab_distance = PARKING_EXTRUDER_GRAB_DISTANCE; // M951 I
#if HAS_HOME_OFFSET
set_home_offset(X_AXIS, mpe_settings.grab_distance * -1);
#endif
TERN_(HAS_HOME_OFFSET, set_home_offset(X_AXIS, mpe_settings.grab_distance * -1));
mpe_settings.slow_feedrate = MMM_TO_MMS(MPE_SLOW_SPEED); // M951 J
mpe_settings.fast_feedrate = MMM_TO_MMS(MPE_FAST_SPEED); // M951 H
mpe_settings.travel_distance = MPE_TRAVEL_DISTANCE; // M951 D
@ -61,9 +59,7 @@ void GcodeSuite::M951() {
if (parser.seenval('R')) mpe_settings.parking_xpos[1] = parser.value_linear_units();
if (parser.seenval('I')) {
mpe_settings.grab_distance = parser.value_linear_units();
#if HAS_HOME_OFFSET
set_home_offset(X_AXIS, mpe_settings.grab_distance * -1);
#endif
TERN_(HAS_HOME_OFFSET, set_home_offset(X_AXIS, mpe_settings.grab_distance * -1));
}
if (parser.seenval('J')) mpe_settings.slow_feedrate = MMM_TO_MMS(parser.value_linear_units());
if (parser.seenval('H')) mpe_settings.fast_feedrate = MMM_TO_MMS(parser.value_linear_units());

View File

@ -127,9 +127,7 @@ void GCodeQueue::_commit_command(bool say_ok
#if NUM_SERIAL > 1
port[index_w] = p;
#endif
#if ENABLED(POWER_LOSS_RECOVERY)
recovery.commit_sdpos(index_w);
#endif
TERN_(POWER_LOSS_RECOVERY, recovery.commit_sdpos(index_w));
if (++index_w >= BUFSIZE) index_w = 0;
length++;
}
@ -522,9 +520,7 @@ void GCodeQueue::get_serial_commands() {
// Process critical commands early
if (strcmp(command, "M108") == 0) {
wait_for_heatup = false;
#if HAS_LCD_MENU
wait_for_user = false;
#endif
TERN_(HAS_LCD_MENU, wait_for_user = false);
}
if (strcmp(command, "M112") == 0) kill(M112_KILL_STR, nullptr, true);
if (strcmp(command, "M410") == 0) quickstop_stepper();
@ -601,9 +597,7 @@ void GCodeQueue::get_available_commands() {
get_serial_commands();
#if ENABLED(SDSUPPORT)
get_sdcard_commands();
#endif
TERN_(SDSUPPORT, get_sdcard_commands());
}
/**

View File

@ -72,14 +72,10 @@ void GcodeSuite::M1001() {
gcode.process_subcommands_now_P(PSTR("M77"));
// Set the progress bar "done" state
#if ENABLED(LCD_SET_PROGRESS_MANUALLY)
ui.set_progress_done();
#endif
TERN_(LCD_SET_PROGRESS_MANUALLY, ui.set_progress_done());
// Purge the recovery file
#if ENABLED(POWER_LOSS_RECOVERY)
recovery.purge();
#endif
TERN_(POWER_LOSS_RECOVERY, recovery.purge());
// Announce SD file completion
SERIAL_ECHOLNPGM(STR_FILE_PRINTED);
@ -88,12 +84,8 @@ void GcodeSuite::M1001() {
#if HAS_LEDS_OFF_FLAG
if (long_print) {
printerEventLEDs.onPrintCompleted();
#if ENABLED(EXTENSIBLE_UI)
ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_PRINT_DONE));
#endif
#if ENABLED(HOST_PROMPT_SUPPORT)
host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT(MSG_PRINT_DONE), CONTINUE_STR);
#endif
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_PRINT_DONE)));
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT(MSG_PRINT_DONE), CONTINUE_STR));
wait_for_user_response(1000UL * TERN(HAS_LCD_MENU, PE_LEDS_COMPLETED_TIME, 30));
printerEventLEDs.onResumeAfterWait();
}
@ -105,9 +97,7 @@ void GcodeSuite::M1001() {
#endif
// Re-select the last printed file in the UI
#if ENABLED(SD_REPRINT_LAST_SELECTED_FILE)
ui.reselect_last_file();
#endif
TERN_(SD_REPRINT_LAST_SELECTED_FILE, ui.reselect_last_file());
}
#endif // SDSUPPORT

View File

@ -38,9 +38,7 @@ void GcodeSuite::M23() {
for (char *fn = parser.string_arg; *fn; ++fn) if (*fn == ' ') *fn = '\0';
card.openFileRead(parser.string_arg);
#if ENABLED(LCD_SET_PROGRESS_MANUALLY)
ui.set_progress(0);
#endif
TERN_(LCD_SET_PROGRESS_MANUALLY, ui.set_progress(0));
}
#endif // SDSUPPORT

View File

@ -64,18 +64,14 @@ void GcodeSuite::M24() {
if (card.isFileOpen()) {
card.startFileprint(); // SD card will now be read for commands
startOrResumeJob(); // Start (or resume) the print job timer
#if ENABLED(POWER_LOSS_RECOVERY)
recovery.prepare();
#endif
TERN_(POWER_LOSS_RECOVERY, recovery.prepare());
}
#if ENABLED(HOST_ACTION_COMMANDS)
#ifdef ACTION_ON_RESUME
host_action_resume();
#endif
#if ENABLED(HOST_PROMPT_SUPPORT)
host_prompt_open(PROMPT_INFO, PSTR("Resuming SD"), DISMISS_STR);
#endif
TERN_(HOST_PROMPT_SUPPORT, host_prompt_open(PROMPT_INFO, PSTR("Resuming SD"), DISMISS_STR));
#endif
ui.reset_status();
@ -105,9 +101,7 @@ void GcodeSuite::M25() {
ui.reset_status();
#if ENABLED(HOST_ACTION_COMMANDS)
#if ENABLED(HOST_PROMPT_SUPPORT)
host_prompt_open(PROMPT_PAUSE_RESUME, PSTR("Pause SD"), PSTR("Resume"));
#endif
TERN_(HOST_PROMPT_SUPPORT, host_prompt_open(PROMPT_PAUSE_RESUME, PSTR("Pause SD"), PSTR("Resume")));
#ifdef ACTION_ON_PAUSE
host_action_pause();
#endif

View File

@ -87,9 +87,7 @@ void GcodeSuite::M104() {
#endif
}
#if ENABLED(AUTOTEMP)
planner.autotemp_M104_M109();
#endif
TERN_(AUTOTEMP, planner.autotemp_M104_M109());
}
/**
@ -139,9 +137,7 @@ void GcodeSuite::M109() {
#endif
}
#if ENABLED(AUTOTEMP)
planner.autotemp_M104_M109();
#endif
TERN_(AUTOTEMP, planner.autotemp_M104_M109());
if (set_temp)
(void)thermalManager.wait_for_hotend(target_extruder, no_wait_for_cooling);

View File

@ -76,9 +76,7 @@ void GcodeSuite::M190() {
const bool no_wait_for_cooling = parser.seenval('S');
if (no_wait_for_cooling || parser.seenval('R')) {
thermalManager.setTargetBed(parser.value_celsius());
#if ENABLED(PRINTJOB_TIMER_AUTOSTART)
thermalManager.check_timer_autostart(true, false);
#endif
TERN_(PRINTJOB_TIMER_AUTOSTART, thermalManager.check_timer_autostart(true, false));
}
else return;

View File

@ -75,9 +75,7 @@ void GcodeSuite::M191() {
const bool no_wait_for_cooling = parser.seenval('S');
if (no_wait_for_cooling || parser.seenval('R')) {
thermalManager.setTargetChamber(parser.value_celsius());
#if ENABLED(PRINTJOB_TIMER_AUTOSTART)
thermalManager.check_timer_autostart(true, false);
#endif
TERN_(PRINTJOB_TIMER_AUTOSTART, thermalManager.check_timer_autostart(true, false));
}
else return;

View File

@ -72,9 +72,7 @@ void GcodeSuite::M303() {
const heater_ind_t e = (heater_ind_t)parser.intval('E');
if (!WITHIN(e, SI, EI)) {
SERIAL_ECHOLNPGM(STR_PID_BAD_EXTRUDER_NUM);
#if ENABLED(EXTENSIBLE_UI)
ExtUI::onPidTuning(ExtUI::result_t::PID_BAD_EXTRUDER_NUM);
#endif
TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_BAD_EXTRUDER_NUM));
return;
}