Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gcode: Improve handling of extended g-code commands with '*;#' characters #6749

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

KevinOConnor
Copy link
Collaborator

The g-code command parser did not allow three characters to be passed as parameters to commands (asterisk, semicolon, pound sign). Rework the parsing code to better leverage the python shlex package so that these characters can be supported.

In particular, this should allow better support for printing g-code files that have unusual characters in the filename.

-Kevin

@meteyou
Copy link
Contributor

meteyou commented Nov 26, 2024

Thx @KevinOConnor! I tested this PR with the "start print" command via webinterface (the origin issue) and it works fine with your fix:

image

@pedrolamas
Copy link
Contributor

Just ran a bunch of tests on this, worked perfectly with whatever strings I threw at it, even with escaped characters!

Thanks Kevin!

Extended g-code command names may only contain A-Z, 0-9, and
underscore, and the first two characters may not be digits.

Signed-off-by: Kevin O'Connor <[email protected]>
Don't silently drop leading numbers and unusual characters at the
start of a command - for example, don't interpret '99M88' as 'M88'.

Don't silently drop spaces in a command - for example, don't interpret
"M 101" as the command "M101".  Doing so will cause other parts of the
code (such as get_raw_command_parameters() ) to not work properly.

Signed-off-by: Kevin O'Connor <[email protected]>
…ters

The g-code command parser did not allow three characters to be passed
as parameters to commands (asterisk, semicolon, pound sign).  Rework
the parsing code to better leverage the python shlex package so that
these characters can be supported.

In particular, this should allow better support for printing g-code
files that have unusual characters in the filename.

Signed-off-by: Kevin O'Connor <[email protected]>
Alter gcmd._command in cmd_default if the special M117/M118 handling
is detected.  This avoids having to recheck for this condition in
get_raw_command_parameters().

Signed-off-by: Kevin O'Connor <[email protected]>
The M23 command has similar requirements for extracting the full
parameter string that M117/M118 have.  Use the same code for those
fixups.

Signed-off-by: Kevin O'Connor <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants