Move default correction matrix of not calibrated printer to world2machine_default() function. Use world2machine_reset() to uncorrected matrix. Call it from world2machine_revert_to_uncorrected() and from world2machine_default() if there is no default shift to remove code duplication.
This commit is contained in:
parent
9bd4d580d7
commit
37ebe5c35d
1 changed files with 14 additions and 10 deletions
|
@ -707,22 +707,26 @@ void world2machine_reset()
|
|||
{
|
||||
const float vx[] = { 1.f, 0.f };
|
||||
const float vy[] = { 0.f, 1.f };
|
||||
#ifdef DEFAULT_Y_OFFSET
|
||||
const float cntr[] = { 0.f, DEFAULT_Y_OFFSET };
|
||||
#else
|
||||
const float cntr[] = { 0.f, 0.f };
|
||||
#endif
|
||||
world2machine_update(vx, vy, cntr);
|
||||
}
|
||||
|
||||
static void world2machine_default()
|
||||
{
|
||||
#ifdef DEFAULT_Y_OFFSET
|
||||
const float vx[] = { 1.f, 0.f };
|
||||
const float vy[] = { 0.f, 1.f };
|
||||
const float cntr[] = { 0.f, DEFAULT_Y_OFFSET };
|
||||
world2machine_update(vx, vy, cntr);
|
||||
#else
|
||||
world2machine_reset();
|
||||
#endif
|
||||
}
|
||||
|
||||
void world2machine_revert_to_uncorrected()
|
||||
{
|
||||
if (world2machine_correction_mode != WORLD2MACHINE_CORRECTION_NONE) {
|
||||
// Reset the machine correction matrix.
|
||||
const float vx[] = { 1.f, 0.f };
|
||||
const float vy[] = { 0.f, 1.f };
|
||||
const float cntr[] = { 0.f, 0.f };
|
||||
world2machine_update(vx, vy, cntr);
|
||||
world2machine_reset();
|
||||
// Wait for the motors to stop and update the current position with the absolute values.
|
||||
st_synchronize();
|
||||
current_position[X_AXIS] = st_get_position_mm(X_AXIS);
|
||||
|
@ -793,7 +797,7 @@ void world2machine_initialize()
|
|||
if (reset) {
|
||||
// SERIAL_ECHOLNPGM("Invalid bed correction matrix. Resetting to identity.");
|
||||
reset_bed_offset_and_skew();
|
||||
world2machine_reset();
|
||||
world2machine_default();
|
||||
} else {
|
||||
world2machine_update(vec_x, vec_y, cntr);
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue