Skip to content

Commit

Permalink
Fixed another delta bug, changed version to 3.4.0beta4
Browse files Browse the repository at this point in the history
  • Loading branch information
dc42 committed Sep 27, 2021
1 parent 36809e2 commit e76c1a5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
17 changes: 12 additions & 5 deletions src/Movement/DriveMovement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#ifndef VERSION
// Note: the complete VERSION string must be in standard version number format and must not contain spaces! This is so that DWC can parse it.
# define MAIN_VERSION "3.4.0beta3+2"
# define MAIN_VERSION "3.4.0beta4"
# ifdef USE_CAN0
# define VERSION_SUFFIX "(CAN0)"
# else
Expand Down

0 comments on commit e76c1a5

Please sign in to comment.