Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Duet3D/RepRapFirmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Crocker <dcrocker@eschertech.com>2021-06-16 22:09:07 +0300
committerDavid Crocker <dcrocker@eschertech.com>2021-06-16 22:09:07 +0300
commitae8fc4c8157d3d2fb3f089f1a8dc22546eb48cce (patch)
tree4121317ecb33a71287eef344a13cb8beae3285fd /src/GCodes/GCodes.cpp
parent69ea8cec862d2f7b47e4693ca1b6f258fa6b6bec (diff)
LockMovementAndWaitForStandstill now also waits for code queue catchup
Diffstat (limited to 'src/GCodes/GCodes.cpp')
-rw-r--r--src/GCodes/GCodes.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/GCodes/GCodes.cpp b/src/GCodes/GCodes.cpp
index ba83e8b8..d65cdc62 100644
--- a/src/GCodes/GCodes.cpp
+++ b/src/GCodes/GCodes.cpp
@@ -648,9 +648,7 @@ bool GCodes::DoFilePrint(GCodeBuffer& gb, const StringRef& reply) noexcept
// We never get here if the file ends in M0 because CancelPrint gets called directly in that case.
// Don't close the file until all moves have been completed, in case the print gets paused.
// Also, this keeps the state as 'Printing' until the print really has finished.
- if ( LockMovementAndWaitForStandstill(gb) // wait until movement has finished
- && IsCodeQueueIdle() // must also wait until deferred command queue has caught up
- )
+ if (LockMovementAndWaitForStandstill(gb)) // wait until movement has finished and deferred command queue has caught up
{
StopPrint(StopPrintReason::normalCompletion);
}
@@ -786,9 +784,7 @@ bool GCodes::DoFilePrint(GCodeBuffer& gb, const StringRef& reply) noexcept
// We never get here if the file ends in M0 because CancelPrint gets called directly in that case.
// Don't close the file until all moves have been completed, in case the print gets paused.
// Also, this keeps the state as 'Printing' until the print really has finished.
- if ( LockMovementAndWaitForStandstill(gb) // wait until movement has finished
- && IsCodeQueueIdle() // must also wait until deferred command queue has caught up
- )
+ if (LockMovementAndWaitForStandstill(gb)) // wait until movement has finished and deferred command queue has caught up
{
StopPrint(StopPrintReason::normalCompletion);
}
@@ -1577,7 +1573,12 @@ bool GCodes::LockMovementAndWaitForStandstill(GCodeBuffer& gb) noexcept
return false;
}
- gb.MotionStopped(); // must do this after we have finished waiting, so that we don't stop waiting when executing G4
+ if (&gb != queuedGCode && !IsCodeQueueIdle()) // wait for deferred command queue to catch up
+ {
+ return false;
+ }
+
+ gb.MotionStopped(); // must do this after we have finished waiting, so that we don't stop waiting when executing G4
if (RTOSIface::GetCurrentTask() == Tasks::GetMainTask())
{