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:
Markus Hitter 2015-07-03 01:19:17 +02:00
parent c6916e2a5b
commit 5a0f7a0e72
1 changed files with 1 additions and 2 deletions

View File

@ -124,8 +124,7 @@ void gcode_parse_char(uint8_t c) {
next_target.read_string == 0
) {
// Check if the field has ended. Either by a new field, space or EOL.
if (last_field && ((c >= 'A' && c <= 'Z') || c == '*' || c == ' ' ||
c == '\r' || c == '\n')) {
if (last_field && (c < '0' || c > '9') && c != '.') {
switch (last_field) {
case 'G':
next_target.G = read_digit.mantissa;