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)))

View file

@ -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

View file

@ -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);

View file

@ -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

View file

@ -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