Browse Source

Followup to serial reform

Reference #13250
pull/1/head
Scott Lahteine 6 years ago
parent
commit
64253e1a58
  1. 11
      Marlin/src/core/serial.h
  2. 28
      Marlin/src/gcode/sdcard/M20-M30_M32-M34_M524_M928.cpp
  3. 3
      Marlin/src/gcode/stats/M31.cpp
  4. 10
      Marlin/src/gcode/temperature/M105.cpp
  5. 9
      Marlin/src/module/temperature.cpp

11
Marlin/src/core/serial.h

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

28
Marlin/src/gcode/sdcard/M20-M30_M32-M34_M524_M928.cpp

@ -51,11 +51,7 @@
*/ */
void GcodeSuite::M20() { void GcodeSuite::M20() {
SERIAL_ECHOLNPGM(MSG_BEGIN_FILE_LIST); SERIAL_ECHOLNPGM(MSG_BEGIN_FILE_LIST);
card.ls( card.ls();
#if NUM_SERIAL > 1
command_queue_port[cmd_queue_index_r]
#endif
);
SERIAL_ECHOLNPGM(MSG_END_FILE_LIST); SERIAL_ECHOLNPGM(MSG_END_FILE_LIST);
} }
@ -160,10 +156,6 @@ void GcodeSuite::M26() {
* OR, with 'C' get the current filename. * OR, with 'C' get the current filename.
*/ */
void GcodeSuite::M27() { void GcodeSuite::M27() {
#if NUM_SERIAL > 1
const int16_t port = serial_port_index;
#endif
if (parser.seen('C')) { if (parser.seen('C')) {
SERIAL_ECHOPGM("Current file: "); SERIAL_ECHOPGM("Current file: ");
card.printFilename(); card.printFilename();
@ -171,19 +163,11 @@ void GcodeSuite::M27() {
#if ENABLED(AUTO_REPORT_SD_STATUS) #if ENABLED(AUTO_REPORT_SD_STATUS)
else if (parser.seenval('S')) else if (parser.seenval('S'))
card.set_auto_report_interval(parser.value_byte() card.set_auto_report_interval(parser.value_byte());
#if NUM_SERIAL > 1
, port
#endif
);
#endif #endif
else else
card.report_status( card.report_status();
#if NUM_SERIAL > 1
port
#endif
);
} }
/** /**
@ -281,11 +265,7 @@ void GcodeSuite::M32() {
* /Miscellaneous/Armchair/Armchair.gcode * /Miscellaneous/Armchair/Armchair.gcode
*/ */
void GcodeSuite::M33() { void GcodeSuite::M33() {
card.printLongPath(parser.string_arg card.printLongPath(parser.string_arg);
#if NUM_SERIAL > 1
, command_queue_port[cmd_queue_index_r]
#endif
);
} }
#endif // LONG_FILENAME_HOST_SUPPORT #endif // LONG_FILENAME_HOST_SUPPORT

3
Marlin/src/gcode/stats/M31.cpp

@ -34,9 +34,6 @@
* M31: Get the time since the start of SD Print (or last M109) * M31: Get the time since the start of SD Print (or last M109)
*/ */
void GcodeSuite::M31() { void GcodeSuite::M31() {
#if NUM_SERIAL > 1
const int16_t port = command_queue_port[cmd_queue_index_r];
#endif
char buffer[21]; char buffer[21];
duration_t elapsed = print_job_timer.duration(); duration_t elapsed = print_job_timer.duration();
elapsed.toString(buffer); elapsed.toString(buffer);

10
Marlin/src/gcode/temperature/M105.cpp

@ -35,17 +35,9 @@ void GcodeSuite::M105() {
const int8_t target_extruder = get_target_extruder_from_command(); const int8_t target_extruder = get_target_extruder_from_command();
if (target_extruder < 0) return; 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 #if HAS_TEMP_SENSOR
SERIAL_ECHOPGM(MSG_OK); SERIAL_ECHOPGM(MSG_OK);
thermalManager.print_heater_states(target_extruder thermalManager.print_heater_states(target_extruder);
#if NUM_SERIAL > 1
, port
#endif
);
#else // !HAS_TEMP_SENSOR #else // !HAS_TEMP_SENSOR
SERIAL_ERROR_MSG(MSG_ERR_NO_THERMISTORS); SERIAL_ERROR_MSG(MSG_ERR_NO_THERMISTORS);
#endif #endif

9
Marlin/src/module/temperature.cpp

@ -2537,9 +2537,6 @@ void Temperature::isr() {
#if ENABLED(SHOW_TEMP_ADC_VALUES) #if ENABLED(SHOW_TEMP_ADC_VALUES)
, rawHotendTemp(target_extruder) , rawHotendTemp(target_extruder)
#endif #endif
#if NUM_SERIAL > 1
, port
#endif
); );
#endif #endif
#if HAS_HEATED_BED #if HAS_HEATED_BED
@ -2547,9 +2544,6 @@ void Temperature::isr() {
#if ENABLED(SHOW_TEMP_ADC_VALUES) #if ENABLED(SHOW_TEMP_ADC_VALUES)
, rawBedTemp() , rawBedTemp()
#endif #endif
#if NUM_SERIAL > 1
, port
#endif
, -1 // BED , -1 // BED
); );
#endif #endif
@ -2566,9 +2560,6 @@ void Temperature::isr() {
#if ENABLED(SHOW_TEMP_ADC_VALUES) #if ENABLED(SHOW_TEMP_ADC_VALUES)
, rawHotendTemp(e) , rawHotendTemp(e)
#endif #endif
#if NUM_SERIAL > 1
, port
#endif
, e , e
); );
#endif #endif

Loading…
Cancel
Save