mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2024-11-30 15:26:18 +00:00
Patch drain_queued_commands_P
Fix a SNAFU that should have been caught in #3012
This commit is contained in:
parent
7f2375ab46
commit
41145e6e81
@ -491,23 +491,20 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
static bool drain_queued_commands_P() {
|
static bool drain_queued_commands_P() {
|
||||||
if (queued_commands_P != NULL) {
|
if (queued_commands_P != NULL) {
|
||||||
// Get the next gcode to run
|
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
char c;
|
char c, cmd[30];
|
||||||
while ((c = queued_commands_P[i++]) && c != '\n') { };
|
strncpy_P(cmd, queued_commands_P, sizeof(cmd) - 1);
|
||||||
if (i > 1) {
|
cmd[sizeof(cmd) - 1] = '\0';
|
||||||
char cmd[i];
|
while ((c = cmd[i]) && c != '\n') i++; // find the end of this gcode command
|
||||||
strncpy_P(cmd, queued_commands_P, i - 1);
|
cmd[i] = '\0';
|
||||||
cmd[i - 1] = '\0';
|
if (enqueue_and_echo_command(cmd)) { // success?
|
||||||
if (enqueue_and_echo_command(cmd)) { // buffer was not full (else we will retry later)
|
if (c) // newline char?
|
||||||
if (c)
|
queued_commands_P += i + 1; // advance to the next command
|
||||||
queued_commands_P += i; // move to next command
|
|
||||||
else
|
else
|
||||||
queued_commands_P = NULL; // no more commands in the sequence
|
queued_commands_P = NULL; // nul char? no more commands
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
return (queued_commands_P != NULL); // return whether any more remain
|
||||||
return (queued_commands_P != NULL); // any more left to add?
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user