Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Duet3D/RepRapFirmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Crocker <dcrocker@eschertech.com>2022-03-08 16:49:10 +0300
committerDavid Crocker <dcrocker@eschertech.com>2022-03-08 16:49:10 +0300
commit873b5056cba92eb4514d8b8256c7c9e25fe315ab (patch)
tree7cc6d938f56dae83e2dcea8383ea1bbeee0fadb7
parent4f89d90738a995e69738965273a5173be4b93e4e (diff)
Increased allowed length of GCode commands to 256 characters
-rw-r--r--src/Config/Configuration.h7
-rw-r--r--src/Display/MenuItem.cpp4
-rw-r--r--src/GCodes/GCodeBuffer/GCodeBuffer.h8
-rw-r--r--src/GCodes/GCodeQueue.h2
-rw-r--r--src/GCodes/GCodes2.cpp5
-rw-r--r--src/Networking/TelnetResponder.h2
-rw-r--r--src/Platform/RepRap.cpp2
-rw-r--r--src/SBC/SbcInterface.cpp4
-rw-r--r--src/Version.h2
9 files changed, 18 insertions, 18 deletions
diff --git a/src/Config/Configuration.h b/src/Config/Configuration.h
index d774d17e..70a0ca48 100644
--- a/src/Config/Configuration.h
+++ b/src/Config/Configuration.h
@@ -168,13 +168,14 @@ constexpr size_t StringLengthLoggedCommand = StringLength100; // Length of a str
#if SAM4E || SAM4S || SAME70 || SAME5x || defined(ESP_NETWORKING)
// Increased GCODE_LENGTH on the SAM4 because M587 and M589 commands on the Duet WiFi can get very long and GCode meta commands can get even longer
-constexpr size_t GCODE_LENGTH = 201; // maximum number of non-comment characters in a line of GCode including the null terminator
+// Also if HAS_SBC_INTERFACE is enabled then it needs to be large enough to hold SBC commands sent in binary mode, see GCodeBuffer.h
+constexpr size_t MaxGCodeLength = 256; // maximum number of non-comment characters in a line of GCode including the null terminator
#else
-constexpr size_t GCODE_LENGTH = 101; // maximum number of non-comment characters in a line of GCode including the null terminator
+constexpr size_t MaxGCodeLength = 101; // maximum number of non-comment characters in a line of GCode including the null terminator
#endif
// Define the maximum length of a GCode that we can queue to synchronise it to a move. Long enough for M150 R255 U255 B255 P255 S255 F1 encoded in binary mode (64 bytes).
-constexpr size_t SHORT_GCODE_LENGTH = 64;
+constexpr size_t ShortGCodeLength = 64;
// Output buffer length and number of buffers
// When using RTOS, it is best if it is possible to fit an HTTP response header in a single buffer. Our headers are currently about 230 bytes long.
diff --git a/src/Display/MenuItem.cpp b/src/Display/MenuItem.cpp
index 8bae0a22..147fe221 100644
--- a/src/Display/MenuItem.cpp
+++ b/src/Display/MenuItem.cpp
@@ -657,7 +657,7 @@ bool ValueMenuItem::Adjust_AlterHelper(int clicks) noexcept
case 21: // 521 baby stepping
{
- String<SHORT_GCODE_LENGTH> cmd;
+ String<ShortGCodeLength> cmd;
cmd.printf("M290 Z%.2f", (double)(0.02 * clicks));
(void) reprap.GetGCodes().ProcessCommandFromLcd(cmd.c_str());
adjusting = AdjustMode::liveAdjusting;
@@ -667,7 +667,7 @@ bool ValueMenuItem::Adjust_AlterHelper(int clicks) noexcept
default:
if (itemNumber >= 10 && itemNumber < 10 + reprap.GetGCodes().GetVisibleAxes()) // 510-518 axis position adjustment
{
- String<SHORT_GCODE_LENGTH> cmd;
+ String<ShortGCodeLength> cmd;
const float amount = ((itemNumber == 12) ? 0.02 : 0.1) * clicks; // 0.02mm Z resolution, 0.1mm for other axes
cmd.printf("M120 G91 G1 F3000 %c%.2f M121", 'X' + (itemNumber - 10), (double)amount);
(void) reprap.GetGCodes().ProcessCommandFromLcd(cmd.c_str());
diff --git a/src/GCodes/GCodeBuffer/GCodeBuffer.h b/src/GCodes/GCodeBuffer/GCodeBuffer.h
index bd5d865c..bf0a5132 100644
--- a/src/GCodes/GCodeBuffer/GCodeBuffer.h
+++ b/src/GCodes/GCodeBuffer/GCodeBuffer.h
@@ -295,13 +295,11 @@ private:
bool timerRunning; // True if we are waiting
bool motionCommanded; // true if this GCode stream has commanded motion since it last waited for motion to stop
-#if HAS_SBC_INTERFACE
- alignas(4) char buffer[MaxCodeBufferSize]; // must be aligned because we do dword fetches from it
-#else
- char buffer[GCODE_LENGTH];
-#endif
+ alignas(4) char buffer[MaxGCodeLength]; // must be aligned because in SBC binary mode we do dword fetches from it
#if HAS_SBC_INTERFACE
+ static_assert(MaxGCodeLength >= MaxCodeBufferSize); // make sure the GCodeBuffer is large enough to hold a command received from the SBC in binary
+
// Accessed by both the Main and SBC tasks
BinarySemaphore macroSemaphore;
volatile bool isWaitingForMacro; // Is this GB waiting in DoFileMacro?
diff --git a/src/GCodes/GCodeQueue.h b/src/GCodes/GCodeQueue.h
index 16a7fda9..1eb6c647 100644
--- a/src/GCodes/GCodeQueue.h
+++ b/src/GCodes/GCodeQueue.h
@@ -12,7 +12,7 @@
class QueuedCode;
-const size_t BufferSizePerQueueItem = SHORT_GCODE_LENGTH;
+const size_t BufferSizePerQueueItem = ShortGCodeLength;
class GCodeQueue : public GCodeInput
{
diff --git a/src/GCodes/GCodes2.cpp b/src/GCodes/GCodes2.cpp
index 62f441c2..382ddd8b 100644
--- a/src/GCodes/GCodes2.cpp
+++ b/src/GCodes/GCodes2.cpp
@@ -1824,7 +1824,7 @@ bool GCodes::HandleMcode(GCodeBuffer& gb, const StringRef& reply) THROWS(GCodeEx
case 118: // Echo message on host
{
gb.MustSee('S');
- String<GCODE_LENGTH> message;
+ String<MaxGCodeLength> message;
gb.GetQuotedString(message.GetRef());
MessageType type = GenericMessage;
@@ -3772,6 +3772,7 @@ bool GCodes::HandleMcode(GCodeBuffer& gb, const StringRef& reply) THROWS(GCodeEx
// M650 (set peel move parameters) and M651 (execute peel move) are no longer handled specially. Use macros to specify what they should do.
+#if SUPPORT_LINEAR_DELTA
case 665: // Set delta configuration
if (!LockMovementAndWaitForStandstill(gb))
{
@@ -3824,7 +3825,7 @@ bool GCodes::HandleMcode(GCodeBuffer& gb, const StringRef& reply) THROWS(GCodeEx
result = GetGCodeResultFromError(error);
}
break;
-
+#endif
case 667: // Set CoreXY mode
if (!LockMovementAndWaitForStandstill(gb))
{
diff --git a/src/Networking/TelnetResponder.h b/src/Networking/TelnetResponder.h
index 87f12d10..4776a867 100644
--- a/src/Networking/TelnetResponder.h
+++ b/src/Networking/TelnetResponder.h
@@ -32,7 +32,7 @@ private:
bool SendGCodeReply() noexcept;
bool haveCompleteLine;
- char clientMessage[GCODE_LENGTH];
+ char clientMessage[MaxGCodeLength];
size_t clientPointer;
uint32_t connectTime;
diff --git a/src/Platform/RepRap.cpp b/src/Platform/RepRap.cpp
index 8c615785..3d0ea399 100644
--- a/src/Platform/RepRap.cpp
+++ b/src/Platform/RepRap.cpp
@@ -2300,7 +2300,7 @@ OutputBuffer *RepRap::GetThumbnailResponse(const char *filename, FilePosition of
for (unsigned int charsWrittenThisCall = 0; charsWrittenThisCall < thumbnailMaxDataSize; )
{
// Read a line
- char lineBuffer[GCODE_LENGTH];
+ char lineBuffer[MaxGCodeLength];
const int charsRead = f->ReadLine(lineBuffer, sizeof(lineBuffer));
if (charsRead <= 0)
{
diff --git a/src/SBC/SbcInterface.cpp b/src/SBC/SbcInterface.cpp
index a81530d0..bb5a4dee 100644
--- a/src/SBC/SbcInterface.cpp
+++ b/src/SBC/SbcInterface.cpp
@@ -502,7 +502,7 @@ void SbcInterface::ExchangeData() noexcept
// Evaluate an expression
case SbcRequest::EvaluateExpression:
{
- String<GCODE_LENGTH> expression;
+ String<MaxGCodeLength> expression;
const GCodeChannel channel = transfer.ReadEvaluateExpression(packet->length, expression.GetRef());
if (channel.IsValid())
{
@@ -644,7 +644,7 @@ void SbcInterface::ExchangeData() noexcept
{
bool createVariable;
String<MaxVariableNameLength> varName;
- String<GCODE_LENGTH> expression;
+ String<MaxGCodeLength> expression;
const GCodeChannel channel = transfer.ReadSetVariable(createVariable, varName.GetRef(), expression.GetRef());
// Make sure we can access the gb safely...
diff --git a/src/Version.h b/src/Version.h
index 53b2d577..4ba52251 100644
--- a/src/Version.h
+++ b/src/Version.h
@@ -10,7 +10,7 @@
#ifndef VERSION
// Note: the complete VERSION string must be in standard version number format and must not contain spaces! This is so that DWC can parse it.
-# define MAIN_VERSION "3.4.0rc2+1"
+# define MAIN_VERSION "3.4.0rc2+2"
# ifdef USE_CAN0
# define VERSION_SUFFIX "(CAN0)"
# else