Repository navigation
GCodeLoader: Fix parsing of files with CRLF line endings. - #35171
Merged
Merged
Conversation
Lines were split at spaces only, so a command without arguments kept the \r of a CRLF line ending and matched none of the checks. G90, G91, M82 and M83 were ignored. Trim each line and split it at any whitespace.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related issue: -
Description
GCodeLoadersplits the file at\nand each line at spaces. With CRLF line endings, a command without arguments keeps the\r('G91\r') and matches none of the command checks. As a result,G90,G91,M82andM83are ignored. Take this program:With CRLF, the moves after
G91go to absolute positions. They also stop extruding, becauseE1is now read as an absolute value.The loader now trims each line and splits it at any whitespace. With this change, both line endings give the LF result above.
test/unit/addons/loaders/GCodeLoader.tests.jsis new. It parses the program with LF and with CRLF line endings and compares the extruded toolpaths, and it fails with the current code. ESLint passes on the changed files.