diff options
author | David Crocker <dcrocker@eschertech.com> | 2021-06-28 14:59:22 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2021-06-28 14:59:22 +0300 |
commit | 7bbdec319e0b0be2a8c282b0df90ebca59cded14 (patch) | |
tree | 4a7f5219b6e7e460ab0751b85b08bba73a1c1486 /src/Storage | |
parent | aa4b6c919514407a8b836618185541e1abf429b0 (diff) |
Removed job.file.firstLayerHeight and job.file.numLayers from the OM
Diffstat (limited to 'src/Storage')
-rw-r--r-- | src/Storage/FileInfoParser.cpp | 71 | ||||
-rw-r--r-- | src/Storage/FileInfoParser.h | 1 |
2 files changed, 0 insertions, 72 deletions
diff --git a/src/Storage/FileInfoParser.cpp b/src/Storage/FileInfoParser.cpp index 1395d6e8..8dc1a96e 100644 --- a/src/Storage/FileInfoParser.cpp +++ b/src/Storage/FileInfoParser.cpp @@ -137,12 +137,6 @@ GCodeResult FileInfoParser::GetFileInfo(const char *filePath, GCodeFileInfo& inf headerInfoComplete &= (parsedFileInfo.numFilaments != 0); } - // Look for first layer height - if (parsedFileInfo.firstLayerHeight == 0.0) - { - headerInfoComplete &= FindFirstLayerHeight(buf, sizeToScan); - } - // Look for layer height if (parsedFileInfo.layerHeight == 0.0) { @@ -351,71 +345,6 @@ GCodeResult FileInfoParser::GetFileInfo(const char *filePath, GCodeFileInfo& inf } // Scan the buffer for a G1 Zxxx command. The buffer is null-terminated. -bool FileInfoParser::FindFirstLayerHeight(const char* bufp, size_t len) noexcept -{ - if (len < 4) - { - // Don't start if the buffer is not big enough - return false; - } - parsedFileInfo.firstLayerHeight = 0.0; - - bool inComment = false, inRelativeMode = false, foundHeight = false; - for(size_t i = 0; i < len - 4; i++) - { - if (bufp[i] == ';') - { - inComment = true; - } - else if (inComment) - { - if (bufp[i] == '\n') - { - inComment = false; - } - } - else if (bufp[i] == 'G') - { - // See if we can switch back to absolute mode - if (inRelativeMode) - { - inRelativeMode = !(bufp[i + 1] == '9' && bufp[i + 2] == '0' && bufp[i + 3] <= ' '); - } - // Ignore G0/G1 codes if in relative mode - else if (bufp[i + 1] == '9' && bufp[i + 2] == '1' && bufp[i + 3] <= ' ') - { - inRelativeMode = true; - } - // Look for "G0/G1 ... Z#HEIGHT#" command - else if ((bufp[i + 1] == '0' || bufp[i + 1] == '1') && bufp[i + 2] == ' ') - { - for(i += 3; i < len - 4; i++) - { - if (bufp[i] == 'Z') - { - //debugPrintf("Found at offset %u text: %.100s\n", i, &buf[i + 1]); - const float flHeight = SafeStrtof(&bufp[i + 1], nullptr); - if ((parsedFileInfo.firstLayerHeight == 0.0 || flHeight < parsedFileInfo.firstLayerHeight) && (flHeight <= reprap.GetPlatform().GetNozzleDiameter() * 3.0)) - { - parsedFileInfo.firstLayerHeight = flHeight; // Only report first Z height if it's somewhat reasonable - foundHeight = true; - // NB: Don't stop here, because some slicers generate two Z moves at the beginning - } - break; - } - else if (bufp[i] == ';') - { - // Ignore comments - break; - } - } - } - } - } - return foundHeight; -} - -// Scan the buffer for a G1 Zxxx command. The buffer is null-terminated. // This parsing algorithm needs to be fast. The old one sometimes took 5 seconds or more to parse about 120K of data. // To speed up parsing, we now parse forwards from the start of the buffer. This means we can't stop when we have found a G1 Z command, // we have to look for a later G1 Z command in the buffer. But it is faster in the (common) case that we don't find a match in the buffer at all. diff --git a/src/Storage/FileInfoParser.h b/src/Storage/FileInfoParser.h index 0e9764dc..8911998e 100644 --- a/src/Storage/FileInfoParser.h +++ b/src/Storage/FileInfoParser.h @@ -53,7 +53,6 @@ private: // G-Code parser methods bool FindHeight(const char* bufp, size_t len) noexcept; - bool FindFirstLayerHeight(const char* bufp, size_t len) noexcept; bool FindLayerHeight(const char* bufp) noexcept; bool FindSlicerInfo(const char* bufp) noexcept; bool FindPrintTime(const char* bufp) noexcept; |