Skip to content

Commit

Permalink
Fix for lost data in BufferedGCodeInput
Browse files Browse the repository at this point in the history
  • Loading branch information
dc42 committed Dec 14, 2023
1 parent d2af075 commit 49834aa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/GCodes/GCodeInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ bool BufferedStreamGCodeInput::FillBuffer(GCodeBuffer *gb) noexcept
const size_t spaceLeft = BufferSpaceLeft();
if (spaceLeft >= GCodeInputUSBReadThreshold)
{
const size_t maxToTransfer = (readingPointer > writingPointer) ? spaceLeft : GCodeInputBufferSize - writingPointer;
const size_t maxToTransfer = (readingPointer > writingPointer || writingPointer == 0) ? spaceLeft : GCodeInputBufferSize - writingPointer;
writingPointer = (writingPointer + device.readBytes(buffer + writingPointer, maxToTransfer)) % GCodeInputBufferSize;
}
return StandardGCodeInput::FillBuffer(gb);
Expand Down

0 comments on commit 49834aa

Please sign in to comment.