diff options
author | David Crocker <dcrocker@eschertech.com> | 2021-09-27 11:50:49 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2021-09-27 11:50:49 +0300 |
commit | e76c1a56191fdc5213a372f983f702be14529090 (patch) | |
tree | 1f586c7227f4d09e310640caad4cadf78d25d0d6 /src/Movement | |
parent | 36809e242cd531d55ffdb498b2afd7080a21eafc (diff) |
Fixed another delta bug, changed version to 3.4.0beta4
Diffstat (limited to 'src/Movement')
-rw-r--r-- | src/Movement/DriveMovement.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/Movement/DriveMovement.cpp b/src/Movement/DriveMovement.cpp index a2f20206..3ae424b2 100644 --- a/src/Movement/DriveMovement.cpp +++ b/src/Movement/DriveMovement.cpp @@ -470,18 +470,25 @@ 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 && drev < dda.totalDistance) // if 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)); const int32_t numStepsUp = (int32_t)((hrev - mp.delta.h0MinusZ0) * stepsPerMm); - // We may be almost at the peak height already, in which case we don't really have a reversal. + // We may be going down but almost at the peak height already, in which case we don't really have a reversal. + // However, we could be going up by a whole step due to rounding, so we need to check the direction if (numStepsUp < 1) { - mp.delta.reverseStartDistance = -1.0; // so that we know we have reversed already - reverseStartStep = totalSteps + 1; - direction = false; + if (direction) + { + mp.delta.reverseStartDistance = dda.totalDistance + 1.0; // indicate that there is no reversal + } + else + { + mp.delta.reverseStartDistance = -1.0; // so that we know we have reversed already + reverseStartStep = totalSteps + 1; + } } else if (direction && (uint32_t)numStepsUp <= totalSteps) { |