Teensy 4.1 Ethernet support (#19801)
This commit is contained in:
@ -39,6 +39,10 @@ GCodeQueue queue;
|
||||
#include "../feature/leds/printer_event_leds.h"
|
||||
#endif
|
||||
|
||||
#if HAS_ETHERNET
|
||||
#include "../feature/ethernet.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(BINARY_FILE_TRANSFER)
|
||||
#include "../feature/binary_stream.h"
|
||||
#endif
|
||||
@ -312,15 +316,24 @@ void GCodeQueue::flush_and_request_resend() {
|
||||
}
|
||||
|
||||
inline bool serial_data_available() {
|
||||
return MYSERIAL0.available() || TERN0(HAS_MULTI_SERIAL, MYSERIAL1.available());
|
||||
byte data_available = 0;
|
||||
if (MYSERIAL0.available()) data_available++;
|
||||
#ifdef SERIAL_PORT_2
|
||||
const bool port2_open = TERN1(HAS_ETHERNET, ethernet.have_telnet_client);
|
||||
if (port2_open && MYSERIAL1.available()) data_available++;
|
||||
#endif
|
||||
return data_available > 0;
|
||||
}
|
||||
|
||||
inline int read_serial(const uint8_t index) {
|
||||
switch (index) {
|
||||
case 0: return MYSERIAL0.read();
|
||||
#if HAS_MULTI_SERIAL
|
||||
case 1: return MYSERIAL1.read();
|
||||
#endif
|
||||
case 1: {
|
||||
#if HAS_MULTI_SERIAL
|
||||
const bool port2_open = TERN1(HAS_ETHERNET, ethernet.have_telnet_client);
|
||||
if (port2_open) return MYSERIAL1.read();
|
||||
#endif
|
||||
}
|
||||
default: return -1;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user