Add custom types for position (#15204)
This commit is contained in:
@ -59,7 +59,7 @@
|
||||
static void quick_home_xy() {
|
||||
|
||||
// Pretend the current position is 0,0
|
||||
current_position[X_AXIS] = current_position[Y_AXIS] = 0.0;
|
||||
current_position.set(0.0, 0.0);
|
||||
sync_plan_position();
|
||||
|
||||
const int x_axis_home_dir =
|
||||
@ -95,7 +95,7 @@
|
||||
|
||||
endstops.validate_homing_move();
|
||||
|
||||
current_position[X_AXIS] = current_position[Y_AXIS] = 0.0;
|
||||
current_position.set(0.0, 0.0);
|
||||
|
||||
#if ENABLED(SENSORLESS_HOMING)
|
||||
tmc_disable_stallguard(stepperX, stealth_states.x);
|
||||
@ -128,17 +128,15 @@
|
||||
|
||||
/**
|
||||
* Move the Z probe (or just the nozzle) to the safe homing point
|
||||
* (Z is already at the right height)
|
||||
*/
|
||||
destination[X_AXIS] = Z_SAFE_HOMING_X_POINT;
|
||||
destination[Y_AXIS] = Z_SAFE_HOMING_Y_POINT;
|
||||
destination[Z_AXIS] = current_position[Z_AXIS]; // Z is already at the right height
|
||||
destination.set(safe_homing_xy, current_position.z);
|
||||
|
||||
#if HOMING_Z_WITH_PROBE
|
||||
destination[X_AXIS] -= probe_offset[X_AXIS];
|
||||
destination[Y_AXIS] -= probe_offset[Y_AXIS];
|
||||
destination -= probe_offset;
|
||||
#endif
|
||||
|
||||
if (position_is_reachable(destination[X_AXIS], destination[Y_AXIS])) {
|
||||
if (position_is_reachable(destination)) {
|
||||
|
||||
if (DEBUGGING(LEVELING)) DEBUG_POS("home_z_safely", destination);
|
||||
|
||||
@ -151,7 +149,7 @@
|
||||
safe_delay(500); // Short delay needed to settle
|
||||
#endif
|
||||
|
||||
do_blocking_move_to_xy(destination[X_AXIS], destination[Y_AXIS]);
|
||||
do_blocking_move_to_xy(destination);
|
||||
homeaxis(Z_AXIS);
|
||||
}
|
||||
else {
|
||||
@ -232,16 +230,14 @@ void GcodeSuite::G28(const bool always_home_all) {
|
||||
#endif
|
||||
|
||||
#if ENABLED(IMPROVE_HOMING_RELIABILITY)
|
||||
slow_homing_t slow_homing { 0 };
|
||||
slow_homing.acceleration.x = planner.settings.max_acceleration_mm_per_s2[X_AXIS];
|
||||
slow_homing.acceleration.y = planner.settings.max_acceleration_mm_per_s2[Y_AXIS];
|
||||
slow_homing_t slow_homing{0};
|
||||
slow_homing.acceleration.set(planner.settings.max_acceleration_mm_per_s2[X_AXIS];
|
||||
planner.settings.max_acceleration_mm_per_s2[Y_AXIS]);
|
||||
planner.settings.max_acceleration_mm_per_s2[X_AXIS] = 100;
|
||||
planner.settings.max_acceleration_mm_per_s2[Y_AXIS] = 100;
|
||||
#if HAS_CLASSIC_JERK
|
||||
slow_homing.jerk.x = planner.max_jerk[X_AXIS];
|
||||
slow_homing.jerk.y = planner.max_jerk[Y_AXIS];
|
||||
planner.max_jerk[X_AXIS] = 0;
|
||||
planner.max_jerk[Y_AXIS] = 0;
|
||||
slow_homing.jerk_xy = planner.max_jerk;
|
||||
planner.max_jerk.set(0, 0);
|
||||
#endif
|
||||
|
||||
planner.reset_acceleration_rates();
|
||||
@ -274,7 +270,7 @@ void GcodeSuite::G28(const bool always_home_all) {
|
||||
home_all = always_home_all || (homeX == homeY && homeX == homeZ),
|
||||
doX = home_all || homeX, doY = home_all || homeY, doZ = home_all || homeZ;
|
||||
|
||||
set_destination_from_current();
|
||||
destination = current_position;
|
||||
|
||||
#if Z_HOME_DIR > 0 // If homing away from BED do Z first
|
||||
|
||||
@ -291,10 +287,10 @@ void GcodeSuite::G28(const bool always_home_all) {
|
||||
|
||||
if (z_homing_height && (doX || doY)) {
|
||||
// Raise Z before homing any other axes and z is not already high enough (never lower z)
|
||||
destination[Z_AXIS] = z_homing_height;
|
||||
if (destination[Z_AXIS] > current_position[Z_AXIS]) {
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("Raise Z (before homing) to ", destination[Z_AXIS]);
|
||||
do_blocking_move_to_z(destination[Z_AXIS]);
|
||||
destination.z = z_homing_height;
|
||||
if (destination.z > current_position.z) {
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("Raise Z (before homing) to ", destination.z);
|
||||
do_blocking_move_to_z(destination.z);
|
||||
}
|
||||
}
|
||||
|
||||
@ -329,14 +325,14 @@ void GcodeSuite::G28(const bool always_home_all) {
|
||||
homeaxis(X_AXIS);
|
||||
|
||||
// Remember this extruder's position for later tool change
|
||||
inactive_extruder_x_pos = current_position[X_AXIS];
|
||||
inactive_extruder_x_pos = current_position.x;
|
||||
|
||||
// Home the 1st (left) extruder
|
||||
active_extruder = 0;
|
||||
homeaxis(X_AXIS);
|
||||
|
||||
// Consider the active extruder to be parked
|
||||
COPY(raised_parked_position, current_position);
|
||||
raised_parked_position = current_position;
|
||||
delayed_move_time = 0;
|
||||
active_extruder_parked = true;
|
||||
|
||||
@ -390,14 +386,14 @@ void GcodeSuite::G28(const bool always_home_all) {
|
||||
homeaxis(X_AXIS);
|
||||
|
||||
// Remember this extruder's position for later tool change
|
||||
inactive_extruder_x_pos = current_position[X_AXIS];
|
||||
inactive_extruder_x_pos = current_position.x;
|
||||
|
||||
// Home the 1st (left) extruder
|
||||
active_extruder = 0;
|
||||
homeaxis(X_AXIS);
|
||||
|
||||
// Consider the active extruder to be parked
|
||||
COPY(raised_parked_position, current_position);
|
||||
raised_parked_position = current_position;
|
||||
delayed_move_time = 0;
|
||||
active_extruder_parked = true;
|
||||
extruder_duplication_enabled = IDEX_saved_duplication_state;
|
||||
@ -441,10 +437,8 @@ void GcodeSuite::G28(const bool always_home_all) {
|
||||
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[X_AXIS] = slow_homing.jerk.x;
|
||||
planner.max_jerk[Y_AXIS] = slow_homing.jerk.y;
|
||||
planner.max_jerk = slow_homing.jerk_xy;
|
||||
#endif
|
||||
|
||||
planner.reset_acceleration_rates();
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user