diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 360128b2a710..3701d32004a5 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -5254,13 +5254,17 @@ void process_next_command() { // Sanitize the current command: // - Skip leading spaces - // - Bypass N[0-9]+[ ]* - // - Overwrite * with nul to mark the end while (*current_command == ' ') ++current_command; + // - Bypass N[0-9]+[ ]* if (*current_command == 'N' && current_command[1] >= '0' && current_command[1] <= '9') { + // Skip the N[0-9] that we just found + current_command += 2; // alternately ++current_command; ++current_command; + // [0-9]* while (*current_command >= '0' && *current_command <= '9') ++current_command; + // - Bypass [ ]* while (*current_command == ' ') ++current_command; } + // - Overwrite * with nul to mark the end char *starpos = strchr(current_command, '*'); // * should always be the last parameter if (starpos) *starpos = '\0';