CoreXY homing bug fix attempt 2.
This commit is contained in:
@@ -72,8 +72,8 @@
|
||||
// on separate pin, but homed in one cycle. Also, it should be noted that the function of hard limits
|
||||
// will not be affected by pin sharing.
|
||||
// NOTE: Defaults are set for a traditional 3-axis CNC machine. Z-axis first to clear, followed by X & Y.
|
||||
#define HOMING_CYCLE_0 (1<<Z_AXIS) // REQUIRED: First move Z to clear workspace.
|
||||
#define HOMING_CYCLE_1 ((1<<X_AXIS)|(1<<Y_AXIS)) // OPTIONAL: Then move X,Y at the same time.
|
||||
#define HOMING_CYCLE_0 (1<<X_AXIS) // REQUIRED: First move Z to clear workspace.
|
||||
#define HOMING_CYCLE_1 (1<<Y_AXIS) // OPTIONAL: Then move X,Y at the same time.
|
||||
// #define HOMING_CYCLE_2 // OPTIONAL: Uncomment and add axes mask to enable
|
||||
|
||||
// Number of homing cycles performed after when the machine initially jogs to limit switches.
|
||||
|
||||
@@ -185,13 +185,12 @@ void limits_go_home(uint8_t cycle_mask)
|
||||
if (bit_istrue(cycle_mask,bit(idx))) {
|
||||
n_active_axis++;
|
||||
#ifdef COREXY
|
||||
int32_t axis_position;
|
||||
if (idx == X_AXIS) {
|
||||
axis_position = system_convert_corexy_to_x_axis_steps(sys.position);
|
||||
int32_t axis_position = system_convert_corexy_to_y_axis_steps(sys.position);
|
||||
sys.position[A_MOTOR] = axis_position;
|
||||
sys.position[B_MOTOR] = -axis_position;
|
||||
} else if (idx == Y_AXIS) {
|
||||
axis_position = system_convert_corexy_to_y_axis_steps(sys.position);
|
||||
int32_t axis_position = system_convert_corexy_to_x_axis_steps(sys.position);
|
||||
sys.position[A_MOTOR] = sys.position[B_MOTOR] = axis_position;
|
||||
} else {
|
||||
sys.position[Z_AXIS] = 0;
|
||||
@@ -306,7 +305,7 @@ void limits_go_home(uint8_t cycle_mask)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef COREXY
|
||||
#ifdef COREXY
|
||||
if (idx==X_AXIS) {
|
||||
int32_t off_axis_position = system_convert_corexy_to_y_axis_steps(sys.position);
|
||||
sys.position[A_MOTOR] = set_axis_position + off_axis_position;
|
||||
|
||||
@@ -292,9 +292,9 @@ uint8_t plan_check_full_buffer()
|
||||
}
|
||||
block->step_event_count = max(block->step_event_count, block->steps[idx]);
|
||||
if (idx == A_MOTOR) {
|
||||
delta_mm = ((target_steps[X_AXIS]-pl.position[X_AXIS]) + (target_steps[Y_AXIS]-pl.position[Y_AXIS]))/settings.steps_per_mm[idx];
|
||||
delta_mm = (target_steps[X_AXIS]-pl.position[X_AXIS] + target_steps[Y_AXIS]-pl.position[Y_AXIS])/settings.steps_per_mm[idx];
|
||||
} else if (idx == B_MOTOR) {
|
||||
delta_mm = ((target_steps[X_AXIS]-pl.position[X_AXIS]) - (target_steps[Y_AXIS]-pl.position[Y_AXIS]))/settings.steps_per_mm[idx];
|
||||
delta_mm = (target_steps[X_AXIS]-pl.position[X_AXIS] - target_steps[Y_AXIS]+pl.position[Y_AXIS])/settings.steps_per_mm[idx];
|
||||
} else {
|
||||
delta_mm = (target_steps[idx] - pl.position[idx])/settings.steps_per_mm[idx];
|
||||
}
|
||||
|
||||
@@ -288,12 +288,11 @@ void system_convert_array_steps_to_mpos(float *position, int32_t *steps)
|
||||
}
|
||||
|
||||
|
||||
// CoreXY calculation only. Returns x or y-axis "steps" based on CoreXY motor steps.
|
||||
int32_t system_convert_corexy_to_x_axis_steps(int32_t *steps)
|
||||
{
|
||||
return( (steps[A_MOTOR] + steps[B_MOTOR])/2 );
|
||||
}
|
||||
|
||||
|
||||
int32_t system_convert_corexy_to_y_axis_steps(int32_t *steps)
|
||||
{
|
||||
return( (steps[A_MOTOR] - steps[B_MOTOR])/2 );
|
||||
|
||||
@@ -106,6 +106,7 @@ float system_convert_axis_steps_to_mpos(int32_t *steps, uint8_t idx);
|
||||
// Updates a machine 'position' array based on the 'step' array sent.
|
||||
void system_convert_array_steps_to_mpos(float *position, int32_t *steps);
|
||||
|
||||
// CoreXY calculation only. Returns x or y-axis "steps" based on CoreXY motor steps.
|
||||
int32_t system_convert_corexy_to_x_axis_steps(int32_t *steps);
|
||||
int32_t system_convert_corexy_to_y_axis_steps(int32_t *steps);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user