diff options
author | David Crocker <dcrocker@eschertech.com> | 2021-01-21 12:03:40 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2021-01-21 12:03:40 +0300 |
commit | 1e667a224ef81566e6b63e21ec0c4c1bbc1316d8 (patch) | |
tree | d982a66aaf63c9207fc44795b43e3b6e1ab8af76 /src | |
parent | 56dbaf6e875ec7eac54e0ad63081f4964d5e71aa (diff) |
Correction to PrepareExtruder
Diffstat (limited to 'src')
-rw-r--r-- | src/Movement/DDA.cpp | 6 | ||||
-rw-r--r-- | src/Movement/DriveMovement.cpp | 8 | ||||
-rw-r--r-- | src/Movement/DriveMovement.h | 2 |
3 files changed, 8 insertions, 8 deletions
diff --git a/src/Movement/DDA.cpp b/src/Movement/DDA.cpp index 29630ea6..7859545e 100644 --- a/src/Movement/DDA.cpp +++ b/src/Movement/DDA.cpp @@ -655,7 +655,7 @@ bool DDA::InitFromRemote(const CanMessageMovementLinear& msg) noexcept params.topSpeedTimesCdivD = (uint32_t)roundU32(topSpeed/deceleration); afterPrepare.topSpeedTimesCdivDPlusDecelStartClocks = params.topSpeedTimesCdivD + msg.accelerationClocks + msg.steadyClocks; afterPrepare.extraAccelerationClocks = msg.accelerationClocks - roundS32(params.accelDistance/topSpeed); - params.compFactor = (topSpeed - startSpeed)/topSpeed; + params.accelCompFactor = (topSpeed - startSpeed)/topSpeed; activeDMs = nullptr; @@ -1302,9 +1302,9 @@ void DDA::Prepare(uint8_t simMode, float extrusionPending[]) noexcept params.decelTime = (topSpeed - endSpeed)/deceleration; params.initialSpeedFraction = startSpeed/topSpeed; params.finalSpeedFraction = endSpeed/topSpeed; - params.compFactor = 1.0 - params.initialSpeedFraction; + params.accelCompFactor = 1.0 - params.initialSpeedFraction; #else - params.compFactor = (topSpeed - startSpeed)/topSpeed; + params.accelCompFactor = (topSpeed - startSpeed)/topSpeed; #endif const float decelStartTime = accelStopTime + steadyTime; afterPrepare.startSpeedTimesCdivA = (uint32_t)roundU32((startSpeed * StepTimer::StepClockRate)/acceleration); diff --git a/src/Movement/DriveMovement.cpp b/src/Movement/DriveMovement.cpp index 0f5cb627..f3de6447 100644 --- a/src/Movement/DriveMovement.cpp +++ b/src/Movement/DriveMovement.cpp @@ -223,7 +223,7 @@ bool DriveMovement::PrepareExtruder(const DDA& dda, const PrepParams& params, fl compensationTime = reprap.GetPlatform().GetPressureAdvance(extruder); const float compensationClocks = compensationTime * (float)StepTimer::StepClockRate; mp.cart.compensationClocks = roundU32(compensationClocks); - mp.cart.accelCompensationClocks = roundU32(compensationClocks * params.compFactor); + mp.cart.accelCompensationClocks = roundU32(compensationClocks * params.accelCompFactor); #ifdef COMPENSATE_SPEED_CHANGES // If there is a speed change at the start of the move, theoretically we should instantly advance or retard the filament by the associated compensation amount. @@ -267,7 +267,7 @@ bool DriveMovement::PrepareExtruder(const DDA& dda, const PrepParams& params, fl if (params.decelDistance * effectiveStepsPerMm < 0.5) // if less than 1 deceleration step { totalSteps = (uint32_t)max<int32_t>(netSteps, 0); - mp.cart.decelStartStep = reverseStartStep = netSteps + 1; + mp.cart.decelStartStep = reverseStartStep = totalSteps + 1; mp.cart.fourMaxStepDistanceMinusTwoDistanceToStopTimesCsquaredDivD = 0; twoDistanceToStopTimesCsquaredDivD = 0; } @@ -298,8 +298,8 @@ bool DriveMovement::PrepareExtruder(const DDA& dda, const PrepParams& params, fl { netSteps = (int32_t)stepsBeforeReverse; } - reverseStartStep = netSteps + 1; totalSteps = (uint32_t)max<int32_t>(netSteps, 0); + reverseStartStep = totalSteps + 1; mp.cart.fourMaxStepDistanceMinusTwoDistanceToStopTimesCsquaredDivD = 0; } } @@ -323,7 +323,7 @@ bool DriveMovement::PrepareRemoteExtruder(const DDA& dda, const PrepParams& para const float compensationTime = reprap.GetPlatform().EutGetRemotePressureAdvance(drive); const float compensationClocks = compensationTime * (float)StepTimer::StepClockRate; mp.cart.compensationClocks = roundU32(compensationClocks); - mp.cart.accelCompensationClocks = roundU32(compensationClocks * params.compFactor); + mp.cart.accelCompensationClocks = roundU32(compensationClocks * params.accelCompFactor); // Recalculate the net total step count to allow for compensation. It may be negative. const float compensationDistance = (dda.endSpeed - dda.startSpeed) * compensationTime; diff --git a/src/Movement/DriveMovement.h b/src/Movement/DriveMovement.h index 1816898d..3223844f 100644 --- a/src/Movement/DriveMovement.h +++ b/src/Movement/DriveMovement.h @@ -102,7 +102,7 @@ struct PrepParams uint32_t topSpeedTimesCdivD; // Parameters used only for extruders - float compFactor; + float accelCompFactor; #if SUPPORT_CAN_EXPANSION // Parameters used by CAN expansion |