Skip to content

Commit

Permalink
Proposed fix for #998
Browse files Browse the repository at this point in the history
G10 is not queued any more if it modifies tool offsets
chrishamm authored and dc42 committed Jan 10, 2025
1 parent 070370e commit 4163338
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/GCodes/GCodeQueue.cpp
Original file line number Diff line number Diff line change
@@ -24,9 +24,10 @@ GCodeQueue::GCodeQueue() noexcept : freeItems(nullptr), queuedItems(nullptr)

// Return true if the GCode in the GCodeBuffer should be queued
// Caller has already checked that the command does not contain an expression and involves modifying tool temperatures or spindle speed
/*static*/ bool GCodeQueue::ShouldQueueG10(GCodeBuffer &gb) noexcept
/*static*/ bool GCodeQueue::ShouldQueueG10(GCodeBuffer &gb, ParameterLettersBitmap allAxisLetters) noexcept
{
return reprap.GetMove().GetScheduledMoves() != reprap.GetMove().GetCompletedMoves()
&& !gb.AllParameters().Intersects(allAxisLetters) // only queue it if it does not modify tool offsets
&& gb.DataLength() <= BufferSizePerQueueItem; // only queue it if it is short enough to fit in a queue item
}

2 changes: 1 addition & 1 deletion src/GCodes/GCodeQueue.h
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@ class GCodeQueue : public GCodeInput

void Diagnostics(MessageType mtype) noexcept;

static bool ShouldQueueG10(GCodeBuffer &gb) noexcept; // Return true if this code should be queued
static bool ShouldQueueG10(GCodeBuffer &gb, ParameterLettersBitmap allAxisLetters) noexcept; // Return true if this code should be queued
static bool ShouldQueueMCode(GCodeBuffer &gb) THROWS(GCodeException); // Return true if this code should be queued

private:
2 changes: 1 addition & 1 deletion src/GCodes/GCodes2.cpp
Original file line number Diff line number Diff line change
@@ -310,7 +310,7 @@ bool GCodes::HandleGcode(GCodeBuffer& gb, const StringRef& reply) THROWS(GCodeEx
// Should we queue this code?
// Don't queue any GCodes if there are segments not yet picked up by Move, because in the event that a segment corresponds to no movement,
// the move gets discarded, which throws out the count of scheduled moves and hence the synchronisation
if (gb.CanQueueCodes() && GCodeQueue::ShouldQueueG10(gb))
if (gb.CanQueueCodes() && GCodeQueue::ShouldQueueG10(gb, allAxisLetters))
{
if (GetMovementState(gb).segmentsLeft == 0 && GetMovementState(gb).codeQueue->QueueCode(gb))
{

0 comments on commit 4163338

Please sign in to comment.