G-code parser: anything but a number ends a field.
This should make the parser a bit more robust and also saves 6 bytes binary size.
This commit is contained in:
parent
c6916e2a5b
commit
5a0f7a0e72
|
|
@ -124,8 +124,7 @@ void gcode_parse_char(uint8_t c) {
|
||||||
next_target.read_string == 0
|
next_target.read_string == 0
|
||||||
) {
|
) {
|
||||||
// Check if the field has ended. Either by a new field, space or EOL.
|
// Check if the field has ended. Either by a new field, space or EOL.
|
||||||
if (last_field && ((c >= 'A' && c <= 'Z') || c == '*' || c == ' ' ||
|
if (last_field && (c < '0' || c > '9') && c != '.') {
|
||||||
c == '\r' || c == '\n')) {
|
|
||||||
switch (last_field) {
|
switch (last_field) {
|
||||||
case 'G':
|
case 'G':
|
||||||
next_target.G = read_digit.mantissa;
|
next_target.G = read_digit.mantissa;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue