Fix multi-serial CRC error crash (#21249)
This commit is contained in:
parent
a0d312396a
commit
101f09aabd
@ -41,5 +41,5 @@ void GcodeSuite::M999() {
|
|||||||
|
|
||||||
if (parser.boolval('S')) return;
|
if (parser.boolval('S')) return;
|
||||||
|
|
||||||
queue.flush_and_request_resend();
|
queue.flush_and_request_resend(queue.ring_buffer.command_port());
|
||||||
}
|
}
|
||||||
|
@ -262,8 +262,7 @@ void GCodeQueue::RingBuffer::ok_to_send() {
|
|||||||
* Send a "Resend: nnn" message to the host to
|
* Send a "Resend: nnn" message to the host to
|
||||||
* indicate that a command needs to be re-sent.
|
* indicate that a command needs to be re-sent.
|
||||||
*/
|
*/
|
||||||
void GCodeQueue::flush_and_request_resend() {
|
void GCodeQueue::flush_and_request_resend(const serial_index_t serial_ind) {
|
||||||
const serial_index_t serial_ind = ring_buffer.command_port();
|
|
||||||
#if HAS_MULTI_SERIAL
|
#if HAS_MULTI_SERIAL
|
||||||
if (serial_ind < 0) return; // Never mind. Command came from SD or Flash Drive
|
if (serial_ind < 0) return; // Never mind. Command came from SD or Flash Drive
|
||||||
PORT_REDIRECT(SERIAL_PORTMASK(serial_ind)); // Reply to the serial port that sent the command
|
PORT_REDIRECT(SERIAL_PORTMASK(serial_ind)); // Reply to the serial port that sent the command
|
||||||
@ -306,7 +305,7 @@ void GCodeQueue::gcode_line_error(PGM_P const err, const serial_index_t serial_i
|
|||||||
SERIAL_ERROR_START();
|
SERIAL_ERROR_START();
|
||||||
SERIAL_ECHOLNPAIR_P(err, serial_state[serial_ind].last_N);
|
SERIAL_ECHOLNPAIR_P(err, serial_state[serial_ind].last_N);
|
||||||
while (read_serial(serial_ind) != -1) { /* nada */ } // Clear out the RX buffer. Why don't use flush here ?
|
while (read_serial(serial_ind) != -1) { /* nada */ } // Clear out the RX buffer. Why don't use flush here ?
|
||||||
flush_and_request_resend();
|
flush_and_request_resend(serial_ind);
|
||||||
serial_state[serial_ind].count = 0;
|
serial_state[serial_ind].count = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,7 +185,7 @@ public:
|
|||||||
* Clear the serial line and request a resend of
|
* Clear the serial line and request a resend of
|
||||||
* the next expected line number.
|
* the next expected line number.
|
||||||
*/
|
*/
|
||||||
static void flush_and_request_resend();
|
static void flush_and_request_resend(const serial_index_t serial_ind);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* (Re)Set the current line number for the last received command
|
* (Re)Set the current line number for the last received command
|
||||||
|
Loading…
Reference in New Issue
Block a user