Distinguish serial index from mask (#21287)
This commit is contained in:
@ -240,7 +240,7 @@ void GCodeQueue::RingBuffer::ok_to_send() {
|
||||
CommandLine &command = commands[index_r];
|
||||
#if HAS_MULTI_SERIAL
|
||||
const serial_index_t serial_ind = command.port;
|
||||
if (serial_ind < 0) return;
|
||||
if (!serial_ind.valid()) return; // Optimization here, skip processing if it's not going anywhere
|
||||
PORT_REDIRECT(SERIAL_PORTMASK(serial_ind)); // Reply to the serial port that sent the command
|
||||
#endif
|
||||
if (command.skip_ok) return;
|
||||
@ -264,15 +264,15 @@ void GCodeQueue::RingBuffer::ok_to_send() {
|
||||
*/
|
||||
void GCodeQueue::flush_and_request_resend(const serial_index_t serial_ind) {
|
||||
#if HAS_MULTI_SERIAL
|
||||
if (serial_ind < 0) return; // Never mind. Command came from SD or Flash Drive
|
||||
if (!serial_ind.valid()) return; // Optimization here, skip if the command came from SD or Flash Drive
|
||||
PORT_REDIRECT(SERIAL_PORTMASK(serial_ind)); // Reply to the serial port that sent the command
|
||||
#endif
|
||||
SERIAL_FLUSH();
|
||||
SERIAL_ECHOPGM(STR_RESEND);
|
||||
SERIAL_ECHOLN(serial_state[serial_ind].last_N + 1);
|
||||
SERIAL_ECHOLN(serial_state[serial_ind.index].last_N + 1);
|
||||
}
|
||||
|
||||
inline bool serial_data_available(uint8_t index) {
|
||||
inline bool serial_data_available(serial_index_t index) {
|
||||
const int a = SERIAL_IMPL.available(index);
|
||||
#if BOTH(RX_BUFFER_MONITOR, RX_BUFFER_SIZE)
|
||||
if (a > RX_BUFFER_SIZE - 2) {
|
||||
@ -290,15 +290,15 @@ inline bool any_serial_data_available() {
|
||||
return true;
|
||||
}
|
||||
|
||||
inline int read_serial(const uint8_t index) { return SERIAL_IMPL.read(index); }
|
||||
inline int read_serial(const serial_index_t index) { return SERIAL_IMPL.read(index); }
|
||||
|
||||
void GCodeQueue::gcode_line_error(PGM_P const err, const serial_index_t serial_ind) {
|
||||
PORT_REDIRECT(SERIAL_PORTMASK(serial_ind)); // Reply to the serial port that sent the command
|
||||
SERIAL_ERROR_START();
|
||||
SERIAL_ECHOLNPAIR_P(err, serial_state[serial_ind].last_N);
|
||||
SERIAL_ECHOLNPAIR_P(err, serial_state[serial_ind.index].last_N);
|
||||
while (read_serial(serial_ind) != -1) { /* nada */ } // Clear out the RX buffer. Why don't use flush here ?
|
||||
flush_and_request_resend(serial_ind);
|
||||
serial_state[serial_ind].count = 0;
|
||||
serial_state[serial_ind.index].count = 0;
|
||||
}
|
||||
|
||||
FORCE_INLINE bool is_M29(const char * const cmd) { // matches "M29" & "M29 ", but not "M290", etc
|
||||
|
Reference in New Issue
Block a user