Simplify serial port redirect (#13234)
This commit is contained in:
@@ -33,19 +33,15 @@
|
||||
|
||||
void M217_report(const bool eeprom=false) {
|
||||
|
||||
#if NUM_SERIAL > 1
|
||||
const int16_t port = command_queue_port[cmd_queue_index_r];
|
||||
#endif
|
||||
|
||||
#if ENABLED(TOOLCHANGE_FILAMENT_SWAP)
|
||||
serialprintPGM_P(port, eeprom ? PSTR(" M217") : PSTR("Singlenozzle:"));
|
||||
SERIAL_ECHOPAIR_P(port, " S", LINEAR_UNIT(toolchange_settings.swap_length));
|
||||
SERIAL_ECHOPAIR_P(port, " P", LINEAR_UNIT(toolchange_settings.prime_speed));
|
||||
SERIAL_ECHOPAIR_P(port, " R", LINEAR_UNIT(toolchange_settings.retract_speed));
|
||||
serialprintPGM(eeprom ? PSTR(" M217") : PSTR("Singlenozzle:"));
|
||||
SERIAL_ECHOPAIR(" S", LINEAR_UNIT(toolchange_settings.swap_length));
|
||||
SERIAL_ECHOPAIR(" P", LINEAR_UNIT(toolchange_settings.prime_speed));
|
||||
SERIAL_ECHOPAIR(" R", LINEAR_UNIT(toolchange_settings.retract_speed));
|
||||
|
||||
#if ENABLED(TOOLCHANGE_PARK)
|
||||
SERIAL_ECHOPAIR_P(port, " X", LINEAR_UNIT(toolchange_settings.change_point.x));
|
||||
SERIAL_ECHOPAIR_P(port, " Y", LINEAR_UNIT(toolchange_settings.change_point.y));
|
||||
SERIAL_ECHOPAIR(" X", LINEAR_UNIT(toolchange_settings.change_point.x));
|
||||
SERIAL_ECHOPAIR(" Y", LINEAR_UNIT(toolchange_settings.change_point.y));
|
||||
#endif
|
||||
|
||||
#else
|
||||
@@ -54,7 +50,7 @@ void M217_report(const bool eeprom=false) {
|
||||
|
||||
#endif
|
||||
|
||||
SERIAL_ECHOPAIR_P(port, " Z", LINEAR_UNIT(toolchange_settings.z_raise));
|
||||
SERIAL_ECHOPAIR(" Z", LINEAR_UNIT(toolchange_settings.z_raise));
|
||||
SERIAL_EOL();
|
||||
}
|
||||
|
||||
|
@@ -23,27 +23,22 @@
|
||||
#include "../gcode.h"
|
||||
#include "../../module/planner.h"
|
||||
|
||||
void report_M92(
|
||||
#if NUM_SERIAL > 1
|
||||
const int8_t port,
|
||||
#endif
|
||||
const bool echo=true, const int8_t e=-1
|
||||
) {
|
||||
if (echo) SERIAL_ECHO_START_P(port); else SERIAL_CHAR(' ');
|
||||
SERIAL_ECHOPAIR_P(port, " M92 X", LINEAR_UNIT(planner.settings.axis_steps_per_mm[X_AXIS]));
|
||||
SERIAL_ECHOPAIR_P(port, " Y", LINEAR_UNIT(planner.settings.axis_steps_per_mm[Y_AXIS]));
|
||||
SERIAL_ECHOPAIR_P(port, " Z", LINEAR_UNIT(planner.settings.axis_steps_per_mm[Z_AXIS]));
|
||||
void report_M92(const bool echo=true, const int8_t e=-1) {
|
||||
if (echo) SERIAL_ECHO_START(); else SERIAL_CHAR(' ');
|
||||
SERIAL_ECHOPAIR(" M92 X", LINEAR_UNIT(planner.settings.axis_steps_per_mm[X_AXIS]));
|
||||
SERIAL_ECHOPAIR(" Y", LINEAR_UNIT(planner.settings.axis_steps_per_mm[Y_AXIS]));
|
||||
SERIAL_ECHOPAIR(" Z", LINEAR_UNIT(planner.settings.axis_steps_per_mm[Z_AXIS]));
|
||||
#if DISABLED(DISTINCT_E_FACTORS)
|
||||
SERIAL_ECHOPAIR_P(port, " E", VOLUMETRIC_UNIT(planner.settings.axis_steps_per_mm[E_AXIS]));
|
||||
SERIAL_ECHOPAIR(" E", VOLUMETRIC_UNIT(planner.settings.axis_steps_per_mm[E_AXIS]));
|
||||
#endif
|
||||
SERIAL_EOL_P(port);
|
||||
SERIAL_EOL();
|
||||
|
||||
#if ENABLED(DISTINCT_E_FACTORS)
|
||||
for (uint8_t i = 0; i < E_STEPPERS; i++) {
|
||||
if (e >= 0 && i != e) continue;
|
||||
if (echo) SERIAL_ECHO_START_P(port); else SERIAL_CHAR(' ');
|
||||
SERIAL_ECHOPAIR_P(port, " M92 T", (int)i);
|
||||
SERIAL_ECHOLNPAIR_P(port, " E", VOLUMETRIC_UNIT(planner.settings.axis_steps_per_mm[E_AXIS_N(i)]));
|
||||
if (echo) SERIAL_ECHO_START(); else SERIAL_CHAR(' ');
|
||||
SERIAL_ECHOPAIR(" M92 T", (int)i);
|
||||
SERIAL_ECHOLNPAIR(" E", VOLUMETRIC_UNIT(planner.settings.axis_steps_per_mm[E_AXIS_N(i)]));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -71,12 +66,7 @@ void GcodeSuite::M92() {
|
||||
#if ENABLED(MAGIC_NUMBERS_GCODE)
|
||||
"HL"
|
||||
#endif
|
||||
)) return report_M92(
|
||||
#if NUM_SERIAL > 1
|
||||
command_queue_port[cmd_queue_index_r],
|
||||
#endif
|
||||
true, target_extruder
|
||||
);
|
||||
)) return report_M92(true, target_extruder);
|
||||
|
||||
LOOP_XYZE(i) {
|
||||
if (parser.seenval(axis_codes[i])) {
|
||||
|
@@ -33,17 +33,11 @@
|
||||
#include "../../gcode/queue.h"
|
||||
#endif
|
||||
|
||||
#if ADD_PORT_ARG
|
||||
#define CHAT_PORT command_queue_port[cmd_queue_index_r]
|
||||
#else
|
||||
#define CHAT_PORT
|
||||
#endif
|
||||
|
||||
/**
|
||||
* M500: Store settings in EEPROM
|
||||
*/
|
||||
void GcodeSuite::M500() {
|
||||
(void)settings.save(CHAT_PORT);
|
||||
(void)settings.save();
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onStoreSettings();
|
||||
#endif
|
||||
@@ -53,11 +47,7 @@ void GcodeSuite::M500() {
|
||||
* M501: Read settings from EEPROM
|
||||
*/
|
||||
void GcodeSuite::M501() {
|
||||
(void)settings.load(
|
||||
#if ENABLED(EEPROM_SETTINGS)
|
||||
CHAT_PORT
|
||||
#endif
|
||||
);
|
||||
(void)settings.load();
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onLoadSettings();
|
||||
#endif
|
||||
@@ -67,7 +57,7 @@ void GcodeSuite::M501() {
|
||||
* M502: Revert to default settings
|
||||
*/
|
||||
void GcodeSuite::M502() {
|
||||
(void)settings.reset(CHAT_PORT);
|
||||
(void)settings.reset();
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onFactoryReset();
|
||||
#endif
|
||||
@@ -79,12 +69,7 @@ void GcodeSuite::M502() {
|
||||
* M503: print settings currently in memory
|
||||
*/
|
||||
void GcodeSuite::M503() {
|
||||
(void)settings.report(
|
||||
parser.seen('S') && !parser.value_bool()
|
||||
#if NUM_SERIAL > 1
|
||||
, command_queue_port[cmd_queue_index_r]
|
||||
#endif
|
||||
);
|
||||
(void)settings.report(parser.boolval('S', true));
|
||||
}
|
||||
|
||||
#endif // !DISABLE_M503
|
||||
@@ -94,7 +79,7 @@ void GcodeSuite::M502() {
|
||||
* M504: Validate EEPROM Contents
|
||||
*/
|
||||
void GcodeSuite::M504() {
|
||||
if (settings.validate(CHAT_PORT))
|
||||
SERIAL_ECHO_MSG_P(command_queue_port[cmd_queue_index_r], "EEPROM OK");
|
||||
if (settings.validate())
|
||||
SERIAL_ECHO_MSG("EEPROM OK");
|
||||
}
|
||||
#endif
|
||||
|
@@ -754,6 +754,8 @@ void GcodeSuite::process_parsed_command(
|
||||
void GcodeSuite::process_next_command() {
|
||||
char * const current_command = command_queue[cmd_queue_index_r];
|
||||
|
||||
PORT_REDIRECT(command_queue_port[cmd_queue_index_r]);
|
||||
|
||||
if (DEBUGGING(ECHO)) {
|
||||
SERIAL_ECHO_START();
|
||||
SERIAL_ECHOLN(current_command);
|
||||
|
@@ -40,14 +40,8 @@
|
||||
* M115: Capabilities string
|
||||
*/
|
||||
void GcodeSuite::M115() {
|
||||
#if NUM_SERIAL > 1
|
||||
const int8_t port = command_queue_port[cmd_queue_index_r];
|
||||
#define CAPLINE(STR,...) cap_line(PSTR(STR), port, __VA_ARGS__)
|
||||
#else
|
||||
#define CAPLINE(STR,...) cap_line(PSTR(STR), __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
SERIAL_ECHOLNPGM_P(port, MSG_M115_REPORT);
|
||||
SERIAL_ECHOLNPGM(MSG_M115_REPORT);
|
||||
|
||||
#if ENABLED(EXTENDED_CAPABILITIES_REPORT)
|
||||
|
||||
|
@@ -328,13 +328,10 @@ void GCodeParser::parse(char *p) {
|
||||
#endif // CNC_COORDINATE_SYSTEMS
|
||||
|
||||
void GCodeParser::unknown_command_error() {
|
||||
#if NUM_SERIAL > 1
|
||||
const int16_t port = command_queue_port[cmd_queue_index_r];
|
||||
#endif
|
||||
SERIAL_ECHO_START_P(port);
|
||||
SERIAL_ECHOPAIR_P(port, MSG_UNKNOWN_COMMAND, command_ptr);
|
||||
SERIAL_CHAR_P(port, '"');
|
||||
SERIAL_EOL_P(port);
|
||||
SERIAL_ECHO_START();
|
||||
SERIAL_ECHOPAIR(MSG_UNKNOWN_COMMAND, command_ptr);
|
||||
SERIAL_CHAR('"');
|
||||
SERIAL_EOL();
|
||||
}
|
||||
|
||||
#if ENABLED(DEBUG_GCODE_PARSER)
|
||||
|
@@ -219,21 +219,22 @@ void ok_to_send() {
|
||||
#if NUM_SERIAL > 1
|
||||
const int16_t port = command_queue_port[cmd_queue_index_r];
|
||||
if (port < 0) return;
|
||||
PORT_REDIRECT(port);
|
||||
#endif
|
||||
if (!send_ok[cmd_queue_index_r]) return;
|
||||
SERIAL_ECHOPGM_P(port, MSG_OK);
|
||||
SERIAL_ECHOPGM(MSG_OK);
|
||||
#if ENABLED(ADVANCED_OK)
|
||||
char* p = command_queue[cmd_queue_index_r];
|
||||
if (*p == 'N') {
|
||||
SERIAL_ECHO_P(port, ' ');
|
||||
SERIAL_ECHO_P(port, *p++);
|
||||
SERIAL_ECHO(' ');
|
||||
SERIAL_ECHO(*p++);
|
||||
while (NUMERIC_SIGNED(*p))
|
||||
SERIAL_ECHO_P(port, *p++);
|
||||
SERIAL_ECHO(*p++);
|
||||
}
|
||||
SERIAL_ECHOPGM_P(port, " P"); SERIAL_ECHO_P(port, int(BLOCK_BUFFER_SIZE - planner.movesplanned() - 1));
|
||||
SERIAL_ECHOPGM_P(port, " B"); SERIAL_ECHO_P(port, BUFSIZE - commands_in_queue);
|
||||
SERIAL_ECHOPGM(" P"); SERIAL_ECHO(int(BLOCK_BUFFER_SIZE - planner.movesplanned() - 1));
|
||||
SERIAL_ECHOPGM(" B"); SERIAL_ECHO(BUFSIZE - commands_in_queue);
|
||||
#endif
|
||||
SERIAL_EOL_P(port);
|
||||
SERIAL_EOL();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -244,10 +245,11 @@ void flush_and_request_resend() {
|
||||
#if NUM_SERIAL > 1
|
||||
const int16_t port = command_queue_port[cmd_queue_index_r];
|
||||
if (port < 0) return;
|
||||
PORT_REDIRECT(port);
|
||||
#endif
|
||||
SERIAL_FLUSH_P(port);
|
||||
SERIAL_ECHOPGM_P(port, MSG_RESEND);
|
||||
SERIAL_ECHOLN_P(port, gcode_LastN + 1);
|
||||
SERIAL_FLUSH();
|
||||
SERIAL_ECHOPGM(MSG_RESEND);
|
||||
SERIAL_ECHOLN(gcode_LastN + 1);
|
||||
ok_to_send();
|
||||
}
|
||||
|
||||
@@ -270,10 +272,11 @@ inline int read_serial(const uint8_t index) {
|
||||
}
|
||||
}
|
||||
|
||||
void gcode_line_error(PGM_P err, uint8_t port) {
|
||||
SERIAL_ERROR_START_P(port);
|
||||
serialprintPGM_P(port, err);
|
||||
SERIAL_ECHOLN_P(port, gcode_LastN);
|
||||
void gcode_line_error(PGM_P const err, const int8_t port) {
|
||||
PORT_REDIRECT(port);
|
||||
SERIAL_ERROR_START();
|
||||
serialprintPGM(err);
|
||||
SERIAL_ECHOLN(gcode_LastN);
|
||||
while (read_serial(port) != -1); // clear out the RX buffer
|
||||
flush_and_request_resend();
|
||||
serial_count[port] = 0;
|
||||
@@ -281,12 +284,6 @@ void gcode_line_error(PGM_P err, uint8_t port) {
|
||||
|
||||
#if ENABLED(FAST_FILE_TRANSFER)
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
#define CARD_CHAR_P(C) SERIAL_CHAR_P(card.transfer_port, C)
|
||||
#define CARD_ECHO_P(V) SERIAL_ECHO_P(card.transfer_port, V)
|
||||
#define CARD_ECHOLN_P(V) SERIAL_ECHOLN_P(card.transfer_port, V)
|
||||
#endif
|
||||
|
||||
inline bool serial_data_available(const uint8_t index) {
|
||||
switch (index) {
|
||||
case 0: return MYSERIAL0.available();
|
||||
@@ -380,6 +377,11 @@ void gcode_line_error(PGM_P err, uint8_t port) {
|
||||
void receive(char (&buffer)[buffer_size]) {
|
||||
uint8_t data = 0;
|
||||
millis_t transfer_timeout = millis() + RX_TIMESLICE;
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
PORT_REDIRECT(card.transfer_port);
|
||||
#endif
|
||||
|
||||
while (PENDING(millis(), transfer_timeout)) {
|
||||
switch (stream_state) {
|
||||
case StreamState::STREAM_RESET:
|
||||
@@ -388,24 +390,24 @@ void gcode_line_error(PGM_P err, uint8_t port) {
|
||||
packet_reset();
|
||||
stream_state = StreamState::PACKET_HEADER;
|
||||
break;
|
||||
case StreamState::STREAM_HEADER: // we could also transfer the filename in this packet, rather than handling it in the gcode
|
||||
for (size_t i = 0; i < sizeof(stream_header); ++i) {
|
||||
case StreamState::STREAM_HEADER: // The filename could also be in this packet, rather than handling it in the gcode
|
||||
for (size_t i = 0; i < sizeof(stream_header); ++i)
|
||||
stream_header_bytes[i] = buffer[i];
|
||||
}
|
||||
|
||||
if (stream_header.token == 0x1234) {
|
||||
stream_state = StreamState::PACKET_RESET;
|
||||
bytes_received = 0;
|
||||
time_stream_start = millis();
|
||||
CARD_ECHO_P("echo: Datastream initialized (");
|
||||
CARD_ECHO_P(stream_header.filesize);
|
||||
CARD_ECHOLN_P("Bytes expected)");
|
||||
CARD_ECHO_P("so"); // confirm active stream and the maximum block size supported
|
||||
CARD_CHAR_P(static_cast<uint8_t>(buffer_size & 0xFF));
|
||||
CARD_CHAR_P(static_cast<uint8_t>((buffer_size >> 8) & 0xFF));
|
||||
CARD_CHAR_P('\n');
|
||||
SERIAL_ECHO("echo: Datastream initialized (");
|
||||
SERIAL_ECHO(stream_header.filesize);
|
||||
SERIAL_ECHOLN("Bytes expected)");
|
||||
SERIAL_ECHO("so"); // confirm active stream and the maximum block size supported
|
||||
SERIAL_CHAR(static_cast<uint8_t>(buffer_size & 0xFF));
|
||||
SERIAL_CHAR(static_cast<uint8_t>((buffer_size >> 8) & 0xFF));
|
||||
SERIAL_CHAR('\n');
|
||||
}
|
||||
else {
|
||||
CARD_ECHOLN_P("echo: Datastream initialization error (invalid token)");
|
||||
SERIAL_ECHOLN("echo: Datastream initialization error (invalid token)");
|
||||
stream_state = StreamState::STREAM_FAILED;
|
||||
}
|
||||
buffer_next_index = 0;
|
||||
@@ -421,7 +423,7 @@ void gcode_line_error(PGM_P err, uint8_t port) {
|
||||
stream_state = StreamState::PACKET_DATA;
|
||||
}
|
||||
else {
|
||||
CARD_ECHO_P("echo: Datastream packet out of order");
|
||||
SERIAL_ECHO("echo: Datastream packet out of order");
|
||||
stream_state = StreamState::PACKET_FLUSHRX;
|
||||
}
|
||||
}
|
||||
@@ -433,7 +435,7 @@ void gcode_line_error(PGM_P err, uint8_t port) {
|
||||
buffer[buffer_next_index] = data;
|
||||
}
|
||||
else {
|
||||
CARD_ECHO_P("echo: Datastream packet data buffer overrun");
|
||||
SERIAL_ECHO("echo: Datastream packet data buffer overrun");
|
||||
stream_state = StreamState::STREAM_FAILED;
|
||||
break;
|
||||
}
|
||||
@@ -458,22 +460,22 @@ void gcode_line_error(PGM_P err, uint8_t port) {
|
||||
else {
|
||||
if (bytes_received < stream_header.filesize) {
|
||||
stream_state = StreamState::PACKET_RESET; // reset and receive next packet
|
||||
CARD_ECHOLN_P("ok"); // transmit confirm packet received and valid token
|
||||
SERIAL_ECHOLN("ok"); // transmit confirm packet received and valid token
|
||||
}
|
||||
else {
|
||||
stream_state = StreamState::STREAM_COMPLETE; // no more data required
|
||||
}
|
||||
if (card.write(buffer, buffer_next_index) < 0) {
|
||||
stream_state = StreamState::STREAM_FAILED;
|
||||
CARD_ECHO_P("echo: IO ERROR");
|
||||
SERIAL_ECHO("echo: IO ERROR");
|
||||
break;
|
||||
};
|
||||
}
|
||||
}
|
||||
else {
|
||||
CARD_ECHO_P("echo: Block(");
|
||||
CARD_ECHO_P(packet.header.id);
|
||||
CARD_ECHOLN_P(") Corrupt");
|
||||
SERIAL_ECHO("echo: Block(");
|
||||
SERIAL_ECHO(packet.header.id);
|
||||
SERIAL_ECHOLN(") Corrupt");
|
||||
stream_state = StreamState::PACKET_FLUSHRX;
|
||||
}
|
||||
break;
|
||||
@@ -481,9 +483,9 @@ void gcode_line_error(PGM_P err, uint8_t port) {
|
||||
if (packet_retries < MAX_RETRIES) {
|
||||
packet_retries ++;
|
||||
stream_state = StreamState::PACKET_RESET;
|
||||
CARD_ECHO_P("echo: Resend request ");
|
||||
CARD_ECHOLN_P(packet_retries);
|
||||
CARD_ECHOLN_P("rs"); // transmit resend packet token
|
||||
SERIAL_ECHO("echo: Resend request ");
|
||||
SERIAL_ECHOLN(packet_retries);
|
||||
SERIAL_ECHOLN("rs"); // transmit resend packet token
|
||||
}
|
||||
else {
|
||||
stream_state = StreamState::STREAM_FAILED;
|
||||
@@ -499,27 +501,27 @@ void gcode_line_error(PGM_P err, uint8_t port) {
|
||||
packet.timeout = millis() + STREAM_MAX_WAIT;
|
||||
break;
|
||||
case StreamState::PACKET_TIMEOUT:
|
||||
CARD_ECHOLN_P("echo: Datastream timeout");
|
||||
SERIAL_ECHOLN("echo: Datastream timeout");
|
||||
stream_state = StreamState::PACKET_RESEND;
|
||||
break;
|
||||
case StreamState::STREAM_COMPLETE:
|
||||
stream_state = StreamState::STREAM_RESET;
|
||||
card.flag.binary_mode = false;
|
||||
card.closefile();
|
||||
CARD_ECHO_P("echo: ");
|
||||
CARD_ECHO_P(card.filename);
|
||||
CARD_ECHO_P(" transfer completed @ ");
|
||||
CARD_ECHO_P(((bytes_received / (millis() - time_stream_start) * 1000) / 1024 ));
|
||||
CARD_ECHOLN_P("KiB/s");
|
||||
CARD_ECHOLN_P("sc"); // transmit stream complete token
|
||||
SERIAL_ECHO("echo: ");
|
||||
SERIAL_ECHO(card.filename);
|
||||
SERIAL_ECHO(" transfer completed @ ");
|
||||
SERIAL_ECHO(((bytes_received / (millis() - time_stream_start) * 1000) / 1024 ));
|
||||
SERIAL_ECHOLN("KiB/s");
|
||||
SERIAL_ECHOLN("sc"); // transmit stream complete token
|
||||
return;
|
||||
case StreamState::STREAM_FAILED:
|
||||
stream_state = StreamState::STREAM_RESET;
|
||||
card.flag.binary_mode = false;
|
||||
card.closefile();
|
||||
card.removeFile(card.filename);
|
||||
CARD_ECHOLN_P("echo: File transfer failed");
|
||||
CARD_ECHOLN_P("sf"); // transmit stream failed token
|
||||
SERIAL_ECHOLN("echo: File transfer failed");
|
||||
SERIAL_ECHOLN("sf"); // transmit stream failed token
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@@ -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
|
||||
|
@@ -42,6 +42,6 @@ void GcodeSuite::M31() {
|
||||
elapsed.toString(buffer);
|
||||
ui.set_status(buffer);
|
||||
|
||||
SERIAL_ECHO_START_P(port);
|
||||
SERIAL_ECHOLNPAIR_P(port, "Print time: ", buffer);
|
||||
SERIAL_ECHO_START();
|
||||
SERIAL_ECHOLNPAIR("Print time: ", buffer);
|
||||
}
|
||||
|
@@ -40,15 +40,15 @@ void GcodeSuite::M105() {
|
||||
#endif
|
||||
|
||||
#if HAS_TEMP_SENSOR
|
||||
SERIAL_ECHOPGM_P(port, MSG_OK);
|
||||
SERIAL_ECHOPGM(MSG_OK);
|
||||
thermalManager.print_heater_states(target_extruder
|
||||
#if NUM_SERIAL > 1
|
||||
, port
|
||||
#endif
|
||||
);
|
||||
#else // !HAS_TEMP_SENSOR
|
||||
SERIAL_ERROR_MSG_P(port, MSG_ERR_NO_THERMISTORS);
|
||||
SERIAL_ERROR_MSG(MSG_ERR_NO_THERMISTORS);
|
||||
#endif
|
||||
|
||||
SERIAL_EOL_P(port);
|
||||
SERIAL_EOL();
|
||||
}
|
||||
|
Reference in New Issue
Block a user