Improve ExtUI, fix compiler errors, warnings (#14441)
This commit is contained in:
committed by
Scott Lahteine
parent
14fb683682
commit
e6cf7860e8
@ -89,6 +89,13 @@ GCodeQueue::GCodeQueue() {
|
||||
for (uint8_t i = 0; i < COUNT(send_ok); i++) send_ok[i] = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether there are any commands yet to be executed
|
||||
*/
|
||||
bool GCodeQueue::has_commands_queued() {
|
||||
return queue.length || injected_commands_P;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the Marlin command queue
|
||||
*/
|
||||
@ -154,6 +161,8 @@ bool GCodeQueue::enqueue_one(const char* cmd) {
|
||||
|
||||
/**
|
||||
* Process the next "immediate" command.
|
||||
* Return 'true' if any commands were processed,
|
||||
* or remain to process.
|
||||
*/
|
||||
bool GCodeQueue::process_injected_command() {
|
||||
if (injected_commands_P == nullptr) return false;
|
||||
@ -161,19 +170,16 @@ bool GCodeQueue::process_injected_command() {
|
||||
char c;
|
||||
size_t i = 0;
|
||||
while ((c = pgm_read_byte(&injected_commands_P[i])) && c != '\n') i++;
|
||||
if (!i) return false;
|
||||
|
||||
char cmd[i + 1];
|
||||
memcpy_P(cmd, injected_commands_P, i);
|
||||
cmd[i] = '\0';
|
||||
if (i) {
|
||||
char cmd[i + 1];
|
||||
memcpy_P(cmd, injected_commands_P, i);
|
||||
cmd[i] = '\0';
|
||||
|
||||
parser.parse(cmd);
|
||||
PORT_REDIRECT(SERIAL_PORT);
|
||||
gcode.process_parsed_command();
|
||||
}
|
||||
injected_commands_P = c ? injected_commands_P + i + 1 : nullptr;
|
||||
|
||||
parser.parse(cmd);
|
||||
PORT_REDIRECT(SERIAL_PORT);
|
||||
gcode.process_parsed_command();
|
||||
PORT_RESTORE();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -183,17 +189,13 @@ bool GCodeQueue::process_injected_command() {
|
||||
* Aborts the current queue, if any.
|
||||
* Note: process_injected_command() will be called to drain any commands afterwards
|
||||
*/
|
||||
void GCodeQueue::inject_P(PGM_P const pgcode) {
|
||||
injected_commands_P = pgcode;
|
||||
}
|
||||
void GCodeQueue::inject_P(PGM_P const pgcode) { injected_commands_P = pgcode; }
|
||||
|
||||
/**
|
||||
* Enqueue and return only when commands are actually enqueued.
|
||||
* Never call this from a G-code handler!
|
||||
*/
|
||||
void GCodeQueue::enqueue_one_now(const char* cmd) {
|
||||
while (!enqueue_one(cmd)) idle();
|
||||
}
|
||||
void GCodeQueue::enqueue_one_now(const char* cmd) { while (!enqueue_one(cmd)) idle(); }
|
||||
|
||||
/**
|
||||
* Enqueue from program memory and return only when commands are actually enqueued
|
||||
|
Reference in New Issue
Block a user