From da4e62b4f4273793db035c3f961d8c3661e32fca Mon Sep 17 00:00:00 2001 From: Bjoern Kerler Date: Thu, 29 Aug 2024 22:13:32 +0200 Subject: [PATCH] Add error message on exceeding cmd buffer length on gcode parsing --- lib/Marlin/Marlin/src/core/language.h | 1 + lib/Marlin/Marlin/src/gcode/queue.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/lib/Marlin/Marlin/src/core/language.h b/lib/Marlin/Marlin/src/core/language.h index b2c194fe03..2a96947757 100644 --- a/lib/Marlin/Marlin/src/core/language.h +++ b/lib/Marlin/Marlin/src/core/language.h @@ -159,6 +159,7 @@ #define MSG_STATS "Stats: " #define MSG_FILE_SAVED "Done saving file." #define MSG_ERR_LINE_NO "Line Number is not Last Line Number+1, Last Line: " +#define MSG_ERR_LINE_LENGTH "Line exceeds max buffer length. Last Line: " #define MSG_ERR_CHECKSUM_MISMATCH "checksum mismatch, Last Line: " #define MSG_ERR_NO_CHECKSUM "No Checksum with line number, Last Line: " #define MSG_FILE_PRINTED "Done printing file" diff --git a/lib/Marlin/Marlin/src/gcode/queue.cpp b/lib/Marlin/Marlin/src/gcode/queue.cpp index 70131d4e09..64bbefa58a 100644 --- a/lib/Marlin/Marlin/src/gcode/queue.cpp +++ b/lib/Marlin/Marlin/src/gcode/queue.cpp @@ -471,6 +471,7 @@ void GCodeQueue::get_serial_commands() { else if (serial_count[i] >= MAX_CMD_SIZE - 1) { // Keep fetching, but ignore normal characters beyond the max length // The command will be injected when EOL is reached + gcode_line_error(PSTR(MSG_ERR_LINE_LENGTH), i); } else if (serial_char == '\\') { // Handle escapes // if we have one more character, copy it over