diff options
author | David Crocker <dcrocker@eschertech.com> | 2022-07-20 19:50:14 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2022-07-20 19:50:14 +0300 |
commit | 3ea04e0def85a75f102841e33c720fda91ba2ee6 (patch) | |
tree | 442e178444c5b5b0e4b5cb477bbb915ea8b62e43 /src/Movement | |
parent | 5501f6d9885d73c96c180f98721d9524bd96290c (diff) |
Fixes to position reversion in expansion board mode (thanks Andy)
Diffstat (limited to 'src/Movement')
-rw-r--r-- | src/Movement/DDA.cpp | 3 | ||||
-rw-r--r-- | src/Movement/Move.cpp | 5 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/Movement/DDA.cpp b/src/Movement/DDA.cpp index 49aedf3f..e91c4290 100644 --- a/src/Movement/DDA.cpp +++ b/src/Movement/DDA.cpp @@ -725,6 +725,7 @@ bool DDA::InitFromRemote(const CanMessageMovementLinear& msg) noexcept shapedSegments = unshapedSegments = nullptr; activeDMs = completedDMs = nullptr; + afterPrepare.drivesMoving.Clear(); # if USE_REMOTE_INPUT_SHAPING const size_t numDrivers = min<size_t>(msg.numDriversMinusOne + 1, min<size_t>(NumDirectDrivers, MaxLinearDriversPerCanSlave)); @@ -828,7 +829,7 @@ bool DDA::InitFromRemote(const CanMessageMovementLinear& msg) noexcept DriveMovement* const pdm = DriveMovement::Allocate(drive, DMState::idle); pdm->totalSteps = labs(delta); // for now this is the number of net steps, but gets adjusted later if there is a reverse in direction pdm->direction = (delta >= 0); // for now this is the direction of net movement, but gets adjusted later if it is a delta movement - + afterPrepare.drivesMoving.SetBit(drive); reprap.GetPlatform().EnableDrivers(drive, false); const bool stepsToDo = ((msg.pressureAdvanceDrives & (1u << drive)) != 0) ? pdm->PrepareExtruder(*this, params) diff --git a/src/Movement/Move.cpp b/src/Movement/Move.cpp index 81f07e8c..754f141e 100644 --- a/src/Movement/Move.cpp +++ b/src/Movement/Move.cpp @@ -1146,7 +1146,7 @@ void Move::RevertPosition(const CanMessageRevertPosition& msg) noexcept CanMessageMovementLinear msg2; msg2.accelerationClocks = msg2.decelClocks = msg.clocksAllowed/4; msg2.steadyClocks = msg.clocksAllowed/8; - msg2.whenToExecute = StepTimer::GetTimerTicks() + msg.clocksAllowed/4; + msg2.whenToExecute = StepTimer::GetMasterTime() + msg.clocksAllowed/4; msg2.numDrivers = NumDirectDrivers; msg2.pressureAdvanceDrives = 0; msg2.seq = 0; @@ -1155,7 +1155,8 @@ void Move::RevertPosition(const CanMessageRevertPosition& msg) noexcept size_t index = 0; bool needSteps = false; const volatile int32_t * const lastMoveStepsTaken = rings[0].GetLastMoveStepsTaken(); - for (size_t driver = 0; driver < NumDirectDrivers; ++driver) + constexpr size_t numDrivers = min<size_t>(NumDirectDrivers, MaxLinearDriversPerCanSlave); + for (size_t driver = 0; driver < numDrivers; ++driver) { int32_t steps = 0; if (msg.whichDrives & (1u << driver)) |