diff --git a/Marlin/src/core/serial.h b/Marlin/src/core/serial.h index 4aae86529..a248014c6 100644 --- a/Marlin/src/core/serial.h +++ b/Marlin/src/core/serial.h @@ -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))) diff --git a/Marlin/src/gcode/sdcard/M20-M30_M32-M34_M524_M928.cpp b/Marlin/src/gcode/sdcard/M20-M30_M32-M34_M524_M928.cpp index a61db7d2d..f8c35166e 100644 --- a/Marlin/src/gcode/sdcard/M20-M30_M32-M34_M524_M928.cpp +++ b/Marlin/src/gcode/sdcard/M20-M30_M32-M34_M524_M928.cpp @@ -51,11 +51,7 @@ */ void GcodeSuite::M20() { SERIAL_ECHOLNPGM(MSG_BEGIN_FILE_LIST); - card.ls( - #if NUM_SERIAL > 1 - command_queue_port[cmd_queue_index_r] - #endif - ); + card.ls(); SERIAL_ECHOLNPGM(MSG_END_FILE_LIST); } @@ -160,10 +156,6 @@ void GcodeSuite::M26() { * OR, with 'C' get the current filename. */ void GcodeSuite::M27() { - #if NUM_SERIAL > 1 - const int16_t port = serial_port_index; - #endif - if (parser.seen('C')) { SERIAL_ECHOPGM("Current file: "); card.printFilename(); @@ -171,19 +163,11 @@ void GcodeSuite::M27() { #if ENABLED(AUTO_REPORT_SD_STATUS) else if (parser.seenval('S')) - card.set_auto_report_interval(parser.value_byte() - #if NUM_SERIAL > 1 - , port - #endif - ); + card.set_auto_report_interval(parser.value_byte()); #endif else - card.report_status( - #if NUM_SERIAL > 1 - port - #endif - ); + card.report_status(); } /** @@ -281,11 +265,7 @@ void GcodeSuite::M32() { * /Miscellaneous/Armchair/Armchair.gcode */ void GcodeSuite::M33() { - card.printLongPath(parser.string_arg - #if NUM_SERIAL > 1 - , command_queue_port[cmd_queue_index_r] - #endif - ); + card.printLongPath(parser.string_arg); } #endif // LONG_FILENAME_HOST_SUPPORT diff --git a/Marlin/src/gcode/stats/M31.cpp b/Marlin/src/gcode/stats/M31.cpp index a9f590f29..1a6d3e8d1 100644 --- a/Marlin/src/gcode/stats/M31.cpp +++ b/Marlin/src/gcode/stats/M31.cpp @@ -34,9 +34,6 @@ * M31: Get the time since the start of SD Print (or last M109) */ void GcodeSuite::M31() { - #if NUM_SERIAL > 1 - const int16_t port = command_queue_port[cmd_queue_index_r]; - #endif char buffer[21]; duration_t elapsed = print_job_timer.duration(); elapsed.toString(buffer); diff --git a/Marlin/src/gcode/temperature/M105.cpp b/Marlin/src/gcode/temperature/M105.cpp index d28e87ded..ec366b23f 100644 --- a/Marlin/src/gcode/temperature/M105.cpp +++ b/Marlin/src/gcode/temperature/M105.cpp @@ -35,17 +35,9 @@ void GcodeSuite::M105() { const int8_t target_extruder = get_target_extruder_from_command(); if (target_extruder < 0) return; - #if NUM_SERIAL > 1 - const int16_t port = command_queue_port[cmd_queue_index_r]; - #endif - #if HAS_TEMP_SENSOR SERIAL_ECHOPGM(MSG_OK); - thermalManager.print_heater_states(target_extruder - #if NUM_SERIAL > 1 - , port - #endif - ); + thermalManager.print_heater_states(target_extruder); #else // !HAS_TEMP_SENSOR SERIAL_ERROR_MSG(MSG_ERR_NO_THERMISTORS); #endif diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 8b494811e..7d1264c14 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -2537,9 +2537,6 @@ void Temperature::isr() { #if ENABLED(SHOW_TEMP_ADC_VALUES) , rawHotendTemp(target_extruder) #endif - #if NUM_SERIAL > 1 - , port - #endif ); #endif #if HAS_HEATED_BED @@ -2547,9 +2544,6 @@ void Temperature::isr() { #if ENABLED(SHOW_TEMP_ADC_VALUES) , rawBedTemp() #endif - #if NUM_SERIAL > 1 - , port - #endif , -1 // BED ); #endif @@ -2566,9 +2560,6 @@ void Temperature::isr() { #if ENABLED(SHOW_TEMP_ADC_VALUES) , rawHotendTemp(e) #endif - #if NUM_SERIAL > 1 - , port - #endif , e ); #endif