Use raise_z in more places

Change in memory:
Flash: -474 bytes
SRAM: 0 bytes
This commit is contained in:
Guðni Már Gilbert 2022-09-03 09:02:52 +00:00 committed by D.R.racer
parent 4758ac3f1b
commit 03b8a6e464
4 changed files with 10 additions and 28 deletions

View File

@ -3061,9 +3061,7 @@ static void gcode_G80()
#endif // TMC2130 #endif // TMC2130
// ~ Z-homing (can not be used "G28", because X & Y-homing would have been done before (Z-homing)) // ~ Z-homing (can not be used "G28", because X & Y-homing would have been done before (Z-homing))
bState=enable_z_endstop(false); bState=enable_z_endstop(false);
current_position[Z_AXIS] -= 1; raise_z(-1);
plan_buffer_line_curposXYZE(homing_feedrate[Z_AXIS] / 40);
st_synchronize();
enable_z_endstop(true); enable_z_endstop(true);
#ifdef TMC2130 #ifdef TMC2130
tmc2130_home_enter(Z_AXIS_MASK); tmc2130_home_enter(Z_AXIS_MASK);
@ -3314,9 +3312,7 @@ bool gcode_M45(bool onlyZ, int8_t verbosity_level)
} }
bool endstops_enabled = enable_endstops(false); bool endstops_enabled = enable_endstops(false);
current_position[Z_AXIS] -= 1; //move 1mm down with disabled endstop raise_z(-1);
plan_buffer_line_curposXYZE(homing_feedrate[Z_AXIS] / 40);
st_synchronize();
// Move the print head close to the bed. // Move the print head close to the bed.
current_position[Z_AXIS] = MESH_HOME_Z_SEARCH; current_position[Z_AXIS] = MESH_HOME_Z_SEARCH;
@ -10571,7 +10567,7 @@ void long_pause() //long pause print
setAllTargetHotends(0); setAllTargetHotends(0);
// Lift z // Lift z
raise_z_above(current_position[Z_AXIS] + Z_PAUSE_LIFT); raise_z(Z_PAUSE_LIFT);
// Move XY to side // Move XY to side
if (axis_known_position[X_AXIS] && axis_known_position[Y_AXIS]) { if (axis_known_position[X_AXIS] && axis_known_position[Y_AXIS]) {

View File

@ -995,8 +995,7 @@ bool find_bed_induction_sensor_point_z(float minimum_z, uint8_t n_iter, int
//printf_P(PSTR("Zs: %f, Z: %f, delta Z: %f"), z_bckp, current_position[Z_AXIS], (z_bckp - current_position[Z_AXIS])); //printf_P(PSTR("Zs: %f, Z: %f, delta Z: %f"), z_bckp, current_position[Z_AXIS], (z_bckp - current_position[Z_AXIS]));
if (fabs(current_position[Z_AXIS] - z_bckp) < 0.025) { if (fabs(current_position[Z_AXIS] - z_bckp) < 0.025) {
//printf_P(PSTR("PINDA triggered immediately, move Z higher and repeat measurement\n")); //printf_P(PSTR("PINDA triggered immediately, move Z higher and repeat measurement\n"));
current_position[Z_AXIS] += 0.5; raise_z(0.5);
go_to_current(homing_feedrate[Z_AXIS]/60);
current_position[Z_AXIS] = minimum_z; current_position[Z_AXIS] = minimum_z;
go_to_current(homing_feedrate[Z_AXIS]/(4*60)); go_to_current(homing_feedrate[Z_AXIS]/(4*60));
// we have to let the planner know where we are right now as it is not where we said to go. // we have to let the planner know where we are right now as it is not where we said to go.
@ -2792,10 +2791,7 @@ canceled:
bool sample_z() { bool sample_z() {
bool sampled = true; bool sampled = true;
//make space //make space
current_position[Z_AXIS] += 150; raise_z(150);
go_to_current(homing_feedrate[Z_AXIS] / 60);
//plan_buffer_line_curposXYZE(feedrate, active_extruder););
lcd_show_fullscreen_message_and_wait_P(_T(MSG_PLACE_STEEL_SHEET)); lcd_show_fullscreen_message_and_wait_P(_T(MSG_PLACE_STEEL_SHEET));
// Sample Z heights for the mesh bed leveling. // Sample Z heights for the mesh bed leveling.

View File

@ -537,11 +537,7 @@ void MMU2::SaveAndPark(bool move_axes, bool turn_off_nozzle) {
} }
// lift Z // lift Z
current_position[Z_AXIS] += MMU_ERR_Z_PAUSE_LIFT; raise_z(MMU_ERR_Z_PAUSE_LIFT);
if (current_position[Z_AXIS] > Z_MAX_POS)
current_position[Z_AXIS] = Z_MAX_POS;
plan_buffer_line_curposXYZE(NOZZLE_PARK_Z_FEEDRATE);
st_synchronize();
// move XY aside // move XY aside
current_position[X_AXIS] = MMU_ERR_X_PAUSE_POS; current_position[X_AXIS] = MMU_ERR_X_PAUSE_POS;

View File

@ -6003,7 +6003,7 @@ void print_stop()
save_statistics(total_filament_used, t); save_statistics(total_filament_used, t);
// lift Z // lift Z
raise_z_above(current_position[Z_AXIS] + 10); raise_z(10);
// if axis are homed, move to parking position. // if axis are homed, move to parking position.
if (axis_known_position[X_AXIS] && axis_known_position[Y_AXIS]) { if (axis_known_position[X_AXIS] && axis_known_position[Y_AXIS]) {
@ -6497,9 +6497,7 @@ bool lcd_selftest()
//current_position[X_AXIS] += 0; //current_position[X_AXIS] += 0;
current_position[Y_AXIS] += 4; current_position[Y_AXIS] += 4;
#endif //TMC2130 #endif //TMC2130
current_position[Z_AXIS] = current_position[Z_AXIS] + 10; raise_z(10);
plan_buffer_line_curposXYZE(manual_feedrate[0] / 60);
st_synchronize();
set_destination_to_current(); set_destination_to_current();
_progress = lcd_selftest_screen(TestScreen::AxisZ, _progress, 3, true, 1500); _progress = lcd_selftest_screen(TestScreen::AxisZ, _progress, 3, true, 1500);
#ifdef TMC2130 #ifdef TMC2130
@ -6509,17 +6507,13 @@ bool lcd_selftest()
#endif //TMC2130 #endif //TMC2130
//raise Z to not damage the bed during and hotend testing //raise Z to not damage the bed during and hotend testing
current_position[Z_AXIS] += 20; raise_z(20);
plan_buffer_line_curposXYZE(manual_feedrate[0] / 60);
st_synchronize();
} }
#ifdef TMC2130 #ifdef TMC2130
if (_result) if (_result)
{ {
current_position[Z_AXIS] = current_position[Z_AXIS] + 10; raise_z(10);
plan_buffer_line_curposXYZE(manual_feedrate[0] / 60);
st_synchronize();
_progress = lcd_selftest_screen(TestScreen::Home, 0, 2, true, 0); _progress = lcd_selftest_screen(TestScreen::Home, 0, 2, true, 0);
bool bres = tmc2130_home_calibrate(X_AXIS); bool bres = tmc2130_home_calibrate(X_AXIS);
_progress = lcd_selftest_screen(TestScreen::Home, 1, 2, true, 0); _progress = lcd_selftest_screen(TestScreen::Home, 1, 2, true, 0);