diff options
author | David Crocker <dcrocker@eschertech.com> | 2021-06-13 01:21:27 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2021-06-13 01:21:27 +0300 |
commit | a7fde45b618c76c03516696d670dd665282873da (patch) | |
tree | 250ec090839017aeac12e7cefa9d1f19dea35835 /src/GCodes/GCodeBuffer/StringParser.cpp | |
parent | 92b7d130d974b6b62780e68d32717a7c6567db6e (diff) |
Various
Support layer counting in GCode files generated by SuperSlicer
When reporting a bad command, display any non-printing characters in hex
Support measuring fan RPMs down to 160 instead of down to 320
After turning a remote heater on, if it was previously off then set its
status to 'heating' pending receiving updated status for it, to make
sure that M116 waits for it
Diffstat (limited to 'src/GCodes/GCodeBuffer/StringParser.cpp')
-rw-r--r-- | src/GCodes/GCodeBuffer/StringParser.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/GCodes/GCodeBuffer/StringParser.cpp b/src/GCodes/GCodeBuffer/StringParser.cpp index abf822e5..8b4df0f0 100644 --- a/src/GCodes/GCodeBuffer/StringParser.cpp +++ b/src/GCodes/GCodeBuffer/StringParser.cpp @@ -266,7 +266,7 @@ bool StringParser::Put(char c) noexcept // This is called when we are fed a null, CR or LF character. // Return true if there is a completed command ready to be executed. -bool StringParser::LineFinished() +bool StringParser::LineFinished() noexcept { if (hadLineNumber) { @@ -1486,9 +1486,21 @@ void StringParser::PrintCommand(const StringRef& s) const noexcept } // Append the full command content to a string +// This is called when we report a "Bad command" error, so make sure we display any control characters. void StringParser::AppendFullCommand(const StringRef &s) const noexcept { - s.cat(gb.buffer); + for (size_t i = commandStart; i < commandEnd; ++i) + { + const char c = gb.buffer[i]; + if (c < 0x20) + { + s.catf("[0x%02x]", (unsigned int)c); + } + else + { + s.cat(c); + } + } } // Called when we start a new file |