Simplify serial port redirect (#13234)

This commit is contained in:
Scott Lahteine
2019-02-23 22:53:01 -06:00
committed by GitHub
parent 88cc1d1a31
commit e15354e387
22 changed files with 575 additions and 876 deletions

View File

@ -50,17 +50,13 @@
* M20: List SD card to serial output
*/
void GcodeSuite::M20() {
#if NUM_SERIAL > 1
const int16_t port = command_queue_port[cmd_queue_index_r];
#endif
SERIAL_ECHOLNPGM_P(port, MSG_BEGIN_FILE_LIST);
SERIAL_ECHOLNPGM(MSG_BEGIN_FILE_LIST);
card.ls(
#if NUM_SERIAL > 1
port
command_queue_port[cmd_queue_index_r]
#endif
);
SERIAL_ECHOLNPGM_P(port, MSG_END_FILE_LIST);
SERIAL_ECHOLNPGM(MSG_END_FILE_LIST);
}
/**
@ -165,11 +161,11 @@ void GcodeSuite::M26() {
*/
void GcodeSuite::M27() {
#if NUM_SERIAL > 1
const int16_t port = command_queue_port[cmd_queue_index_r];
const int16_t port = serial_port_index;
#endif
if (parser.seen('C')) {
SERIAL_ECHOPGM_P(port, "Current file: ");
SERIAL_ECHOPGM("Current file: ");
card.printFilename();
}
@ -197,10 +193,6 @@ void GcodeSuite::M28() {
#if ENABLED(FAST_FILE_TRANSFER)
#if NUM_SERIAL > 1
const int16_t port = command_queue_port[cmd_queue_index_r];
#endif
bool binary_mode = false;
char *p = parser.string_arg;
if (p[0] == 'B' && NUMERIC(p[1])) {
@ -211,12 +203,12 @@ void GcodeSuite::M28() {
// Binary transfer mode
if ((card.flag.binary_mode = binary_mode)) {
SERIAL_ECHO_START_P(port);
SERIAL_ECHO_P(port, " preparing to receive: ");
SERIAL_ECHOLN_P(port, p);
SERIAL_ECHO_START();
SERIAL_ECHO(" preparing to receive: ");
SERIAL_ECHOLN(p);
card.openFile(p, false);
#if NUM_SERIAL > 1
card.transfer_port = port;
card.transfer_port = command_queue_port[cmd_queue_index_r];
#endif
}
else