Merge pull request #2987 from thinkyhead/gcode_allow_no_initial_space
Fix handling of spaces in GCode
This commit is contained in:
commit
7f30f85602
@ -973,6 +973,7 @@ void get_command() {
|
|||||||
bool code_has_value() {
|
bool code_has_value() {
|
||||||
int i = 1;
|
int i = 1;
|
||||||
char c = seen_pointer[i];
|
char c = seen_pointer[i];
|
||||||
|
while (c == ' ') c = seen_pointer[++i];
|
||||||
if (c == '-' || c == '+') c = seen_pointer[++i];
|
if (c == '-' || c == '+') c = seen_pointer[++i];
|
||||||
if (c == '.') c = seen_pointer[++i];
|
if (c == '.') c = seen_pointer[++i];
|
||||||
return (c >= '0' && c <= '9');
|
return (c >= '0' && c <= '9');
|
||||||
@ -5691,7 +5692,7 @@ void process_next_command() {
|
|||||||
|
|
||||||
// Sanitize the current command:
|
// Sanitize the current command:
|
||||||
// - Skip leading spaces
|
// - Skip leading spaces
|
||||||
// - Bypass N[0-9][0-9]*[ ]*
|
// - Bypass N[-0-9][0-9]*[ ]*
|
||||||
// - Overwrite * with nul to mark the end
|
// - Overwrite * with nul to mark the end
|
||||||
while (*current_command == ' ') ++current_command;
|
while (*current_command == ' ') ++current_command;
|
||||||
if (*current_command == 'N' && ((current_command[1] >= '0' && current_command[1] <= '9') || current_command[1] == '-')) {
|
if (*current_command == 'N' && ((current_command[1] >= '0' && current_command[1] <= '9') || current_command[1] == '-')) {
|
||||||
@ -5716,7 +5717,7 @@ void process_next_command() {
|
|||||||
// Args pointer optimizes code_seen, especially those taking XYZEF
|
// Args pointer optimizes code_seen, especially those taking XYZEF
|
||||||
// This wastes a little cpu on commands that expect no arguments.
|
// This wastes a little cpu on commands that expect no arguments.
|
||||||
current_command_args = current_command;
|
current_command_args = current_command;
|
||||||
while (*current_command_args && *current_command_args != ' ') ++current_command_args;
|
while (*current_command_args >= '0' && *current_command_args <= '9') ++current_command_args;
|
||||||
while (*current_command_args == ' ') ++current_command_args;
|
while (*current_command_args == ' ') ++current_command_args;
|
||||||
|
|
||||||
// Interpret the code int
|
// Interpret the code int
|
||||||
|
Loading…
Reference in New Issue
Block a user