Browse Source

Minor cleanup to command dispatcher

pull/1/head
Scott Lahteine 9 years ago
parent
commit
5f8e52aefb
  1. 21
      Marlin/Marlin_main.cpp

21
Marlin/Marlin_main.cpp

@ -6082,25 +6082,22 @@ void process_next_command() {
// Skip spaces to get the numeric part
while (*cmd_ptr == ' ') cmd_ptr++;
// The code must have a numeric value
bool code_is_good = false;
uint16_t codenum = 0; // define ahead of goto
int codenum = 0; // define ahead of goto
// Bail early if there's no code
bool code_is_good = NUMERIC(*cmd_ptr);
if (!code_is_good) goto ExitUnknownCommand;
// Get and skip the code number
while (*cmd_ptr >= '0' && *cmd_ptr <= '9') {
code_is_good = true;
codenum = codenum * 10 + *cmd_ptr - '0';
do {
codenum = (codenum * 10) + (*cmd_ptr - '0');
cmd_ptr++;
}
// Bail early if there's no code
if (!code_is_good) goto ExitUnknownCommand;
} while (NUMERIC(*cmd_ptr));
// Skip all spaces to get to the first argument
// Skip all spaces to get to the first argument, or nul
while (*cmd_ptr == ' ') cmd_ptr++;
// The command's arguments start here, for sure!
// The command's arguments (if any) start here, for sure!
current_command_args = cmd_ptr;
KEEPALIVE_STATE(IN_HANDLER);

Loading…
Cancel
Save