|
@@ -191,7 +191,6 @@ bool GCodeQueue::process_injected_command() {
|
191
|
191
|
// Execute command if non-blank
|
192
|
192
|
if (i) {
|
193
|
193
|
parser.parse(cmd);
|
194
|
|
- PORT_REDIRECT(SERIAL_PORT);
|
195
|
194
|
gcode.process_parsed_command();
|
196
|
195
|
}
|
197
|
196
|
return true;
|
|
@@ -243,7 +242,7 @@ void GCodeQueue::ok_to_send() {
|
243
|
242
|
#if NUM_SERIAL > 1
|
244
|
243
|
const int16_t pn = port[index_r];
|
245
|
244
|
if (pn < 0) return;
|
246
|
|
- PORT_REDIRECT(pn);
|
|
245
|
+ PORT_REDIRECT(pn); // Reply to the serial port that sent the command
|
247
|
246
|
#endif
|
248
|
247
|
if (!send_ok[index_r]) return;
|
249
|
248
|
SERIAL_ECHOPGM(MSG_OK);
|
|
@@ -267,9 +266,9 @@ void GCodeQueue::ok_to_send() {
|
267
|
266
|
*/
|
268
|
267
|
void GCodeQueue::flush_and_request_resend() {
|
269
|
268
|
#if NUM_SERIAL > 1
|
270
|
|
- const int16_t p = port[index_r];
|
271
|
|
- if (p < 0) return;
|
272
|
|
- PORT_REDIRECT(p);
|
|
269
|
+ const int16_t pn = port[index_r];
|
|
270
|
+ if (pn < 0) return;
|
|
271
|
+ PORT_REDIRECT(pn); // Reply to the serial port that sent the command
|
273
|
272
|
#endif
|
274
|
273
|
SERIAL_FLUSH();
|
275
|
274
|
SERIAL_ECHOPGM(MSG_RESEND);
|
|
@@ -296,14 +295,14 @@ inline int read_serial(const uint8_t index) {
|
296
|
295
|
}
|
297
|
296
|
}
|
298
|
297
|
|
299
|
|
-void GCodeQueue::gcode_line_error(PGM_P const err, const int8_t port) {
|
300
|
|
- PORT_REDIRECT(port);
|
|
298
|
+void GCodeQueue::gcode_line_error(PGM_P const err, const int8_t pn) {
|
|
299
|
+ PORT_REDIRECT(pn); // Reply to the serial port that sent the command
|
301
|
300
|
SERIAL_ERROR_START();
|
302
|
301
|
serialprintPGM(err);
|
303
|
302
|
SERIAL_ECHOLN(last_N);
|
304
|
|
- while (read_serial(port) != -1); // clear out the RX buffer
|
|
303
|
+ while (read_serial(pn) != -1); // Clear out the RX buffer
|
305
|
304
|
flush_and_request_resend();
|
306
|
|
- serial_count[port] = 0;
|
|
305
|
+ serial_count[pn] = 0;
|
307
|
306
|
}
|
308
|
307
|
|
309
|
308
|
FORCE_INLINE bool is_M29(const char * const cmd) { // matches "M29" & "M29 ", but not "M290", etc
|