Allow SERIAL_ECHOPAIR to take up to 12 pairs (#13311)

This commit is contained in:
Scott Lahteine
2019-03-05 06:46:19 -06:00
committed by GitHub
parent 4771e372a1
commit cfdb38eda4
30 changed files with 474 additions and 611 deletions

View File

@ -346,12 +346,7 @@ inline bool look_for_lines_to_connect() {
if (position_is_reachable(sx, sy) && position_is_reachable(ex, ey)) {
if (g26_debug_flag) {
SERIAL_ECHOPAIR(" Connecting with horizontal line (sx=", sx);
SERIAL_ECHOPAIR(", sy=", sy);
SERIAL_ECHOPAIR(") -> (ex=", ex);
SERIAL_ECHOPAIR(", ey=", ey);
SERIAL_CHAR(')');
SERIAL_EOL();
SERIAL_ECHOLNPAIR(" Connecting with horizontal line (sx=", sx, ", sy=", sy, ") -> (ex=", ex, ", ey=", ey, ")");
//debug_current_and_destination(PSTR("Connecting horizontal line."));
}
print_line_from_here_to_there(sx, sy, g26_layer_height, ex, ey, g26_layer_height);

View File

@ -272,8 +272,7 @@ void GCodeParser::parse(char *p) {
#if ENABLED(DEBUG_GCODE_PARSER)
if (debug) {
SERIAL_ECHOPAIR("Got letter ", code);
SERIAL_ECHOPAIR(" at index ", (int)(p - command_ptr - 1));
SERIAL_ECHOPAIR("Got letter ", code, " at index ", (int)(p - command_ptr - 1));
if (has_num) SERIAL_ECHOPGM(" (has_num)");
}
#endif
@ -329,47 +328,41 @@ void GCodeParser::parse(char *p) {
void GCodeParser::unknown_command_error() {
SERIAL_ECHO_START();
SERIAL_ECHOPAIR(MSG_UNKNOWN_COMMAND, command_ptr);
SERIAL_CHAR('"');
SERIAL_EOL();
SERIAL_ECHOLNPAIR(MSG_UNKNOWN_COMMAND, command_ptr, "\"");
}
#if ENABLED(DEBUG_GCODE_PARSER)
void GCodeParser::debug() {
SERIAL_ECHOPAIR("Command: ", command_ptr);
SERIAL_ECHOPAIR(" (", command_letter);
SERIAL_ECHOPAIR("Command: ", command_ptr, " (", command_letter);
SERIAL_ECHO(codenum);
SERIAL_ECHOLNPGM(")");
#if ENABLED(FASTER_GCODE_PARSER)
SERIAL_ECHOPGM(" args: \"");
for (char c = 'A'; c <= 'Z'; ++c)
if (seen(c)) { SERIAL_CHAR(c); SERIAL_CHAR(' '); }
SERIAL_ECHOPGM(" args: { ");
for (char c = 'A'; c <= 'Z'; ++c) if (seen(c)) { SERIAL_CHAR(c); SERIAL_CHAR(' '); }
SERIAL_CHAR('}');
#else
SERIAL_ECHOPAIR(" args: \"", command_args);
SERIAL_ECHOPAIR(" args: { ", command_args, " }");
#endif
SERIAL_CHAR('"');
if (string_arg) {
SERIAL_ECHOPGM(" string: \"");
SERIAL_ECHO(string_arg);
SERIAL_CHAR('"');
}
if (string_arg) SERIAL_ECHOPAIR(" string: \"", string_arg, "\"");
SERIAL_ECHOLNPGM("\n");
for (char c = 'A'; c <= 'Z'; ++c) {
if (seen(c)) {
SERIAL_ECHOPAIR("Code '", c); SERIAL_ECHOPGM("':");
if (has_value()) {
SERIAL_ECHOPAIR("\n float: ", value_float());
SERIAL_ECHOPAIR("\n long: ", value_long());
SERIAL_ECHOPAIR("\n ulong: ", value_ulong());
SERIAL_ECHOPAIR("\n millis: ", value_millis());
SERIAL_ECHOPAIR("\n sec-ms: ", value_millis_from_seconds());
SERIAL_ECHOPAIR("\n int: ", value_int());
SERIAL_ECHOPAIR("\n ushort: ", value_ushort());
SERIAL_ECHOPAIR("\n byte: ", (int)value_byte());
SERIAL_ECHOPAIR("\n bool: ", (int)value_bool());
SERIAL_ECHOPAIR("\n linear: ", value_linear_units());
SERIAL_ECHOPAIR("\n celsius: ", value_celsius());
SERIAL_ECHOPAIR(
"\n float: ", value_float(),
"\n long: ", value_long(),
"\n ulong: ", value_ulong(),
"\n millis: ", value_millis(),
"\n sec-ms: ", value_millis_from_seconds(),
"\n int: ", value_int(),
"\n ushort: ", value_ushort(),
"\n byte: ", (int)value_byte(),
"\n bool: ", (int)value_bool(),
"\n linear: ", value_linear_units(),
"\n celsius: ", value_celsius()
);
}
else
SERIAL_ECHOPGM(" (no value)");

View File

@ -120,8 +120,7 @@ public:
param[ind] = ptr ? ptr - command_ptr : 0; // parameter offset or 0
#if ENABLED(DEBUG_GCODE_PARSER)
if (codenum == 800) {
SERIAL_ECHOPAIR("Set bit ", (int)ind);
SERIAL_ECHOPAIR(" of codebits (", hex_address((void*)(codebits >> 16)));
SERIAL_ECHOPAIR("Set bit ", (int)ind, " of codebits (", hex_address((void*)(codebits >> 16)));
print_hex_word((uint16_t)(codebits & 0xFFFF));
SERIAL_ECHOLNPAIR(") | param = ", (int)param[ind]);
}

View File

@ -150,9 +150,7 @@ bool enqueue_and_echo_command(const char* cmd) {
if (_enqueuecommand(cmd)) {
SERIAL_ECHO_START();
SERIAL_ECHOPAIR(MSG_ENQUEUEING, cmd);
SERIAL_CHAR('"');
SERIAL_EOL();
SERIAL_ECHOLNPAIR(MSG_ENQUEUEING, cmd, "\"");
return true;
}
return false;
@ -398,9 +396,10 @@ void gcode_line_error(PGM_P const err, const int8_t port) {
stream_state = StreamState::PACKET_RESET;
bytes_received = 0;
time_stream_start = millis();
SERIAL_ECHOPAIR("echo: Datastream initialized (", stream_header.filesize);
SERIAL_ECHOLNPGM(" bytes expected)");
SERIAL_ECHOLNPAIR("so", buffer_size); // confirm active stream and the maximum block size supported
// confirm active stream and the maximum block size supported
SERIAL_ECHO_START();
SERIAL_ECHOLNPAIR("Datastream initialized (", stream_header.filesize, " bytes expected)");
SERIAL_ECHOLNPAIR("so", buffer_size);
}
else {
SERIAL_ECHO_MSG("Datastream init error (invalid token)");
@ -468,8 +467,7 @@ void gcode_line_error(PGM_P const err, const int8_t port) {
}
else {
SERIAL_ECHO_START();
SERIAL_ECHOPAIR("Block(", packet.header.id);
SERIAL_ECHOLNPGM(") Corrupt");
SERIAL_ECHOLNPAIR("Block(", packet.header.id, ") Corrupt");
stream_state = StreamState::PACKET_FLUSHRX;
}
break;
@ -504,8 +502,7 @@ void gcode_line_error(PGM_P const err, const int8_t port) {
card.flag.binary_mode = false;
SERIAL_ECHO_START();
SERIAL_ECHO(card.filename);
SERIAL_ECHOPAIR(" transfer completed @ ", ((bytes_received / (millis() - time_stream_start) * 1000) / 1024));
SERIAL_ECHOLNPGM("KiB/s");
SERIAL_ECHOLNPAIR(" transfer completed @ ", ((bytes_received / (millis() - time_stream_start) * 1000) / 1024), "KiB/s");
SERIAL_ECHOLNPGM("sc"); // transmit stream complete token
card.closefile();
return;