Fix and improve G-code queue (#21122)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
@@ -260,13 +260,6 @@ void GcodeSuite::dwell(millis_t time) {
|
||||
|
||||
#endif // HAS_LEVELING && G29_RETRY_AND_RECOVER
|
||||
|
||||
//
|
||||
// Placeholders for non-migrated codes
|
||||
//
|
||||
#if ENABLED(M100_FREE_MEMORY_WATCHER)
|
||||
extern void M100_dump_routine(PGM_P const title, const char * const start, const char * const end);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Process the parsed command and dispatch it to its handler
|
||||
*/
|
||||
@@ -994,30 +987,32 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
|
||||
SERIAL_OUT(msgDone); // Call the msgDone serial hook to signal command processing done
|
||||
}
|
||||
|
||||
#if ENABLED(M100_FREE_MEMORY_DUMPER)
|
||||
void M100_dump_routine(PGM_P const title, const char * const start, const uintptr_t size);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Process a single command and dispatch it to its handler
|
||||
* This is called from the main loop()
|
||||
*/
|
||||
void GcodeSuite::process_next_command() {
|
||||
char * const current_command = queue.command_buffer[queue.index_r];
|
||||
GCodeQueue::CommandLine &command = queue.ring_buffer.peek_next_command();
|
||||
|
||||
PORT_REDIRECT(SERIAL_PORTMASK(queue.port[queue.index_r]));
|
||||
PORT_REDIRECT(SERIAL_PORTMASK(command.port));
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
recovery.queue_index_r = queue.index_r;
|
||||
#endif
|
||||
TERN_(POWER_LOSS_RECOVERY, recovery.queue_index_r = queue.ring_buffer.index_r);
|
||||
|
||||
if (DEBUGGING(ECHO)) {
|
||||
SERIAL_ECHO_START();
|
||||
SERIAL_ECHOLN(current_command);
|
||||
SERIAL_ECHOLN(command.buffer);
|
||||
#if ENABLED(M100_FREE_MEMORY_DUMPER)
|
||||
SERIAL_ECHOPAIR("slot:", queue.index_r);
|
||||
M100_dump_routine(PSTR(" Command Queue:"), &queue.command_buffer[0][0], &queue.command_buffer[BUFSIZE - 1][MAX_CMD_SIZE - 1]);
|
||||
SERIAL_ECHOPAIR("slot:", queue.ring_buffer.index_r);
|
||||
M100_dump_routine(PSTR(" Command Queue:"), (const char*)&queue.ring_buffer, sizeof(queue.ring_buffer));
|
||||
#endif
|
||||
}
|
||||
|
||||
// Parse the next command in the queue
|
||||
parser.parse(current_command);
|
||||
parser.parse(command.buffer);
|
||||
process_parsed_command();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user