Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gcode: Improve handling of extended g-code commands with '*;#' charac…
…ters (#450) * gcode: Validate extended g-code command names 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]> * gcode: Don't silently discard characters inside a command name 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]> * gcode: Improve handling of extended g-code commands with '*;#' characters 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]> * gcode: Fixup M117/M118 command identification in cmd_default() 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]> * gcode: Use the same M117/M118 fixup for M23 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]> * gcode: Some optimizations to get_raw_command_parameters() Add some minor optimizations to the get_raw_command_parameters() code. Signed-off-by: Kevin O'Connor <[email protected]> * gcode: Improve checksum detection in get_raw_command_parameters() Only consider a trailing '*' to indicate a checksum if the remainder of the string is a number. Signed-off-by: Kevin O'Connor <[email protected]> --------- Signed-off-by: Kevin O'Connor <[email protected]> Co-authored-by: Kevin O'Connor <[email protected]>
- Loading branch information