Browse Source

Use raise_z in more places

Change in memory:
Flash: -474 bytes
SRAM: 0 bytes
Guðni Már Gilbert 2 years ago
parent
commit
03b8a6e464
4 changed files with 10 additions and 28 deletions
  1. 3 7
      Firmware/Marlin_main.cpp
  2. 2 6
      Firmware/mesh_bed_calibration.cpp
  3. 1 5
      Firmware/mmu2.cpp
  4. 4 10
      Firmware/ultralcd.cpp

+ 3 - 7
Firmware/Marlin_main.cpp

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

+ 2 - 6
Firmware/mesh_bed_calibration.cpp

@@ -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]));
 		if (fabs(current_position[Z_AXIS] - z_bckp) < 0.025) {
 			//printf_P(PSTR("PINDA triggered immediately, move Z higher and repeat measurement\n")); 
-			current_position[Z_AXIS] += 0.5;
-			go_to_current(homing_feedrate[Z_AXIS]/60);
+			raise_z(0.5);
 			current_position[Z_AXIS] = minimum_z;
             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.
@@ -2792,10 +2791,7 @@ canceled:
 bool sample_z() {
 	bool sampled = true;
 	//make space
-	current_position[Z_AXIS] += 150;
-	go_to_current(homing_feedrate[Z_AXIS] / 60);
-	//plan_buffer_line_curposXYZE(feedrate, active_extruder););
-
+	raise_z(150);
 	lcd_show_fullscreen_message_and_wait_P(_T(MSG_PLACE_STEEL_SHEET));
 
 	// Sample Z heights for the mesh bed leveling.

+ 1 - 5
Firmware/mmu2.cpp

@@ -537,11 +537,7 @@ void MMU2::SaveAndPark(bool move_axes, bool turn_off_nozzle) {
             }
 
             // lift Z
-            current_position[Z_AXIS] += 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();
+            raise_z(MMU_ERR_Z_PAUSE_LIFT);
 
             // move XY aside
             current_position[X_AXIS] = MMU_ERR_X_PAUSE_POS;

+ 4 - 10
Firmware/ultralcd.cpp

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