|
@@ -272,21 +272,7 @@ void GCodeQueue::flush_and_request_resend(const serial_index_t serial_ind) {
|
272
|
272
|
SERIAL_ECHOLN(serial_state[serial_ind].last_N + 1);
|
273
|
273
|
}
|
274
|
274
|
|
275
|
|
-// Multiserial already handle the dispatch to/from multiple port by itself
|
276
|
|
-inline bool serial_data_available(uint8_t index = SERIAL_ALL) {
|
277
|
|
- if (index == SERIAL_ALL) {
|
278
|
|
- for (index = 0; index < NUM_SERIAL; index++) {
|
279
|
|
- const int a = SERIAL_IMPL.available(index);
|
280
|
|
- #if BOTH(RX_BUFFER_MONITOR, RX_BUFFER_SIZE)
|
281
|
|
- if (a > RX_BUFFER_SIZE - 2) {
|
282
|
|
- PORT_REDIRECT(SERIAL_PORTMASK(index));
|
283
|
|
- SERIAL_ERROR_MSG("RX BUF overflow, increase RX_BUFFER_SIZE: ", a);
|
284
|
|
- }
|
285
|
|
- #endif
|
286
|
|
- if (a > 0) return true;
|
287
|
|
- }
|
288
|
|
- return false;
|
289
|
|
- }
|
|
275
|
+inline bool serial_data_available(uint8_t index) {
|
290
|
276
|
const int a = SERIAL_IMPL.available(index);
|
291
|
277
|
#if BOTH(RX_BUFFER_MONITOR, RX_BUFFER_SIZE)
|
292
|
278
|
if (a > RX_BUFFER_SIZE - 2) {
|
|
@@ -294,10 +280,16 @@ inline bool serial_data_available(uint8_t index = SERIAL_ALL) {
|
294
|
280
|
SERIAL_ERROR_MSG("RX BUF overflow, increase RX_BUFFER_SIZE: ", a);
|
295
|
281
|
}
|
296
|
282
|
#endif
|
297
|
|
-
|
298
|
283
|
return a > 0;
|
299
|
284
|
}
|
300
|
285
|
|
|
286
|
+// Multiserial already handles dispatch to/from multiple ports
|
|
287
|
+inline bool any_serial_data_available() {
|
|
288
|
+ LOOP_L_N(p, NUM_SERIAL)
|
|
289
|
+ if (serial_data_available(p))
|
|
290
|
+ return true;
|
|
291
|
+}
|
|
292
|
+
|
301
|
293
|
inline int read_serial(const uint8_t index) { return SERIAL_IMPL.read(index); }
|
302
|
294
|
|
303
|
295
|
void GCodeQueue::gcode_line_error(PGM_P const err, const serial_index_t serial_ind) {
|
|
@@ -409,7 +401,7 @@ void GCodeQueue::get_serial_commands() {
|
409
|
401
|
// send "wait" to indicate Marlin is still waiting.
|
410
|
402
|
#if NO_TIMEOUTS > 0
|
411
|
403
|
const millis_t ms = millis();
|
412
|
|
- if (ring_buffer.empty() && !serial_data_available() && ELAPSED(ms, last_command_time + NO_TIMEOUTS)) {
|
|
404
|
+ if (ring_buffer.empty() && !any_serial_data_available() && ELAPSED(ms, last_command_time + NO_TIMEOUTS)) {
|
413
|
405
|
SERIAL_ECHOLNPGM(STR_WAIT);
|
414
|
406
|
last_command_time = ms;
|
415
|
407
|
}
|