Followup to serial reform

Reference #13250
This commit is contained in:
Scott Lahteine
2019-02-24 15:04:29 -06:00
parent 92a4984066
commit 64253e1a58
5 changed files with 10 additions and 51 deletions

View File

@ -42,18 +42,14 @@ enum MarlinDebugFlags : uint8_t {
extern uint8_t marlin_debug_flags;
#define DEBUGGING(F) (marlin_debug_flags & (MARLIN_DEBUG_## F))
#if TX_BUFFER_SIZE < 1
#define SERIAL_FLUSHTX()
#endif
#if NUM_SERIAL > 1
extern int8_t serial_port_index;
#define _PORT_REDIRECT(n,p) REMEMBER(n,serial_port_index,p)
#define _PORT_RESTORE(n) RESTORE(n)
#define SERIAL_BOTH 0x7F
#define SERIAL_OUT(WHAT, ...) do{ \
if (!serial_port_index || serial_port_index == SERIAL_BOTH) MYSERIAL0.WHAT(##__VA_ARGS__); \
if ( serial_port_index) MYSERIAL1.WHAT(##__VA_ARGS__); \
if (!serial_port_index || serial_port_index == SERIAL_BOTH) MYSERIAL0.WHAT(__VA_ARGS__); \
if ( serial_port_index) MYSERIAL1.WHAT(__VA_ARGS__); \
}while(0)
#else
#define _PORT_REDIRECT(n,p) NOOP
@ -72,8 +68,11 @@ extern uint8_t marlin_debug_flags;
#define SERIAL_PRINTLN(x,b) SERIAL_OUT(println, x, b)
#define SERIAL_PRINTF(args...) SERIAL_OUT(printf, args)
#define SERIAL_FLUSH() SERIAL_OUT(flush)
#if TX_BUFFER_SIZE > 0
#define SERIAL_FLUSHTX() SERIAL_OUT(flushTX)
#else
#define SERIAL_FLUSHTX()
#endif
#define SERIAL_ECHOPGM(x) (serialprintPGM(PSTR(x)))