diff --git a/Marlin/Marlin.h b/Marlin/Marlin.h index ded8b1f50e..c0b773430d 100644 --- a/Marlin/Marlin.h +++ b/Marlin/Marlin.h @@ -314,6 +314,7 @@ float code_value_temp_diff(); void adjust_delta(float cartesian[3]); #endif #elif ENABLED(SCARA) + extern float delta[3]; extern float axis_scaling[3]; // Build size scaling void inverse_kinematics(const float cartesian[3]); void forward_kinematics_SCARA(float f_scara[3]); diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 777d910163..68bffded0e 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -456,7 +456,7 @@ static uint8_t target_extruder; #define TOWER_2 Y_AXIS #define TOWER_3 Z_AXIS - float delta[3] = { 0 }; + float delta[3]; float cartesian_position[3] = { 0 }; #define SIN_60 0.8660254037844386 #define COS_60 0.5 @@ -489,7 +489,7 @@ static uint8_t target_extruder; #if ENABLED(SCARA) float delta_segments_per_second = SCARA_SEGMENTS_PER_SECOND; - static float delta[3] = { 0 }; + float delta[3]; float axis_scaling[3] = { 1, 1, 1 }; // Build size scaling, default to 1 #endif diff --git a/Marlin/planner.cpp b/Marlin/planner.cpp index 7ced932c9b..ac41165d51 100644 --- a/Marlin/planner.cpp +++ b/Marlin/planner.cpp @@ -1183,7 +1183,12 @@ void Planner::reset_acceleration_rates() { // Recalculate position, steps_to_mm if axis_steps_per_mm changes! void Planner::refresh_positioning() { LOOP_XYZE(i) planner.steps_to_mm[i] = 1.0 / planner.axis_steps_per_mm[i]; - set_position_mm(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); + #if ENABLED(DELTA) || ENABLED(SCARA) + inverse_kinematics(current_position); + set_position_mm(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS]); + #else + set_position_mm(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); + #endif reset_acceleration_rates(); }