diff options
Diffstat (limited to 'src/Movement')
-rw-r--r-- | src/Movement/DriveMovement.cpp | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/Movement/DriveMovement.cpp b/src/Movement/DriveMovement.cpp index e110adb1..ba3b4dbc 100644 --- a/src/Movement/DriveMovement.cpp +++ b/src/Movement/DriveMovement.cpp @@ -470,7 +470,19 @@ bool DriveMovement::PrepareDeltaAxis(const DDA& dda, const PrepParams& params) n const float drev = ((dda.directionVector[Z_AXIS] * fastSqrtf(params.a2plusb2 * params.dparams->GetDiagonalSquared(drive) - fsquare(A * dda.directionVector[Y_AXIS] - B * dda.directionVector[X_AXIS]))) - aAplusbB)/params.a2plusb2; mp.delta.reverseStartDistance = drev; - if (drev > 0.0 && drev < dda.totalDistance) // if the reversal point is within range + if (drev <= 0.0) + { + // No reversal, going down + reverseStartStep = totalSteps + 1; + direction = false; + } + else if (drev >= dda.totalDistance) + { + // No reversal, going up + reverseStartStep = totalSteps + 1; + direction = true; + } + else // the reversal point is within range { // Calculate how many steps we need to move up before reversing const float hrev = dda.directionVector[Z_AXIS] * drev + fastSqrtf(dSquaredMinusAsquaredMinusBsquared - 2 * drev * aAplusbB - params.a2plusb2 * fsquare(drev)); @@ -517,12 +529,6 @@ bool DriveMovement::PrepareDeltaAxis(const DDA& dda, const PrepParams& params) n } } } - else - { - // No reversal - reverseStartStep = totalSteps + 1; - direction = (drev >= 0.0); - } } distanceSoFar = 0.0; |