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>2020-08-28 17:30:27 +0300
committerDavid Crocker <dcrocker@eschertech.com>2020-08-28 17:30:27 +0300
commit2f8c5b0e98747dc28974f56e084304df8b2e770b (patch)
treebfc7fa2647ed2a769158cf64faa846168ad35180 /src/GCodes/GCodeBuffer/StringParser.cpp
parentce3b93cd737f34c9206d6c42e3d277676c7f1f58 (diff)
Added M584 R parameter; support T{expression}
Diffstat (limited to 'src/GCodes/GCodeBuffer/StringParser.cpp')
-rw-r--r--src/GCodes/GCodeBuffer/StringParser.cpp50
1 files changed, 30 insertions, 20 deletions
diff --git a/src/GCodes/GCodeBuffer/StringParser.cpp b/src/GCodes/GCodeBuffer/StringParser.cpp
index efbdc175..d7ee0e7b 100644
--- a/src/GCodes/GCodeBuffer/StringParser.cpp
+++ b/src/GCodes/GCodeBuffer/StringParser.cpp
@@ -705,36 +705,46 @@ void StringParser::DecodeCommand() noexcept
commandLetter = cl;
hasCommandNumber = false;
commandNumber = -1;
- parameterStart = commandStart + 1;
- const bool negative = (gb.buffer[parameterStart] == '-');
- if (negative)
+ if (cl == 'T' && gb.buffer[commandStart + 1] == '{')
{
- ++parameterStart;
+ // It's a T command with an expression for the tool number. This will be treated as if it's "T T{...}.
+ commandLetter = cl;
+ hasCommandNumber = false;
+ parameterStart = commandStart; // so that 'Seen('T')' will return true
}
- if (isdigit(gb.buffer[parameterStart]))
+ else
{
- hasCommandNumber = true;
- // Read the number after the command letter
- commandNumber = 0;
- do
+ parameterStart = commandStart + 1;
+ const bool negative = (gb.buffer[parameterStart] == '-');
+ if (negative)
{
- commandNumber = (10 * commandNumber) + (gb.buffer[parameterStart] - '0');
++parameterStart;
}
- while (isdigit(gb.buffer[parameterStart]));
- if (negative)
+ if (isdigit(gb.buffer[parameterStart]))
{
- commandNumber = -commandNumber;
- }
+ hasCommandNumber = true;
+ // Read the number after the command letter
+ commandNumber = 0;
+ do
+ {
+ commandNumber = (10 * commandNumber) + (gb.buffer[parameterStart] - '0');
+ ++parameterStart;
+ }
+ while (isdigit(gb.buffer[parameterStart]));
+ if (negative)
+ {
+ commandNumber = -commandNumber;
+ }
- // Read the fractional digit, if any
- if (gb.buffer[parameterStart] == '.')
- {
- ++parameterStart;
- if (isdigit(gb.buffer[parameterStart]))
+ // Read the fractional digit, if any
+ if (gb.buffer[parameterStart] == '.')
{
- commandFraction = gb.buffer[parameterStart] - '0';
++parameterStart;
+ if (isdigit(gb.buffer[parameterStart]))
+ {
+ commandFraction = gb.buffer[parameterStart] - '0';
+ ++parameterStart;
+ }
}
}
}