diff options
Diffstat (limited to 'src/Movement/DDARing.cpp')
-rw-r--r-- | src/Movement/DDARing.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/Movement/DDARing.cpp b/src/Movement/DDARing.cpp index 17a66224..fc84012d 100644 --- a/src/Movement/DDARing.cpp +++ b/src/Movement/DDARing.cpp @@ -204,8 +204,18 @@ void DDARing::Spin(uint8_t simulationMode, bool shouldStartMove) noexcept // No DDA is executing, so start executing a new one if possible if (shouldStartMove || !CanAddMove()) { - PrepareMoves(getPointer, 0, 0, simulationMode); - DDA * const dda = getPointer; // capture volatile variable + DDA * dda = getPointer; // capture volatile variable + if (dda->GetState() == DDA::provisional) + { + PrepareMoves(dda, 0, 0, simulationMode); + while (dda->GetState() == DDA::completed) + { + // We prepared the move but found there was nothing to do because endstops are already triggered + getPointer = dda = dda->GetNext(); + completedMoves++; + } + } + if (dda->GetState() == DDA::frozen) { if (simulationMode != 0) |