diff options
author | David Crocker <dcrocker@eschertech.com> | 2016-08-20 20:07:07 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2016-08-20 20:07:07 +0300 |
commit | 84a274f7484fb2436733d500e597cf1a8d42baab (patch) | |
tree | ea2ce8c9bfd3a7e09dfbaed6c2bdb3c528d0efb6 /src | |
parent | ed40658c455095ebd7ecdc2eebfb9d8455a49261 (diff) |
One the way to 1.15rc3
Fixedbug with PrintMonitor code to find object height
Qualify some omre #include filenames with paths, to reduce the number of
include file paths needed in the compiler options
Diffstat (limited to 'src')
-rw-r--r-- | src/Platform.cpp | 2 | ||||
-rw-r--r-- | src/PrintMonitor.cpp | 31 | ||||
-rw-r--r-- | src/Storage/FileStore.h | 2 |
3 files changed, 24 insertions, 11 deletions
diff --git a/src/Platform.cpp b/src/Platform.cpp index 1c7ef38c..6030e644 100644 --- a/src/Platform.cpp +++ b/src/Platform.cpp @@ -20,7 +20,7 @@ ****************************************************************************************************/ #include "RepRapFirmware.h" -#include "DueFlashStorage.h" +#include "Libraries/Flash/DueFlashStorage.h" #include "sam/drivers/tc/tc.h" #include "sam/drivers/hsmci/hsmci.h" diff --git a/src/PrintMonitor.cpp b/src/PrintMonitor.cpp index 31bf2baa..c9386657 100644 --- a/src/PrintMonitor.cpp +++ b/src/PrintMonitor.cpp @@ -494,7 +494,6 @@ bool PrintMonitor::GetFileInfo(const char *directory, const char *fileName, GCod if (parseState == parsingFooter) { // Processing the footer. See how many bytes we need to read and if we can reuse the overlap - bool footerInfoComplete = true; FilePosition pos = fileBeingParsed->Position(); sizeToRead = (size_t)min<FilePosition>(fileBeingParsed->Length() - pos, GCODE_READ_SIZE); if (fileOverlapLength > 0) @@ -525,23 +524,34 @@ bool PrintMonitor::GetFileInfo(const char *directory, const char *fileName, GCod accumulatedReadTime += now - startTime; startTime = now; + bool footerInfoComplete = true; + // Search for filament used if (parsedFileInfo.numFilaments == 0) { parsedFileInfo.numFilaments = FindFilamentUsed(buf, sizeToScan, parsedFileInfo.filamentNeeded, DRIVES - AXES); - footerInfoComplete &= (parsedFileInfo.numFilaments != 0); + if (parsedFileInfo.numFilaments == 0) + { + footerInfoComplete = false; + } } // Search for layer height if (parsedFileInfo.layerHeight == 0.0) { - footerInfoComplete &= FindLayerHeight(buf, sizeToScan, parsedFileInfo.layerHeight); + if (!FindLayerHeight(buf, sizeToScan, parsedFileInfo.layerHeight)) + { + footerInfoComplete = false; + } } // Search for object height if (parsedFileInfo.objectHeight == 0.0) { - footerInfoComplete &= FindHeight(buf, sizeToScan, parsedFileInfo.objectHeight); + if (!FindHeight(buf, sizeToScan, parsedFileInfo.objectHeight)) + { + footerInfoComplete = false; + } } // Keep track of the time stats @@ -917,16 +927,18 @@ bool PrintMonitor::FindHeight(const char* buf, size_t len, float& height) const if (len < 5) { - break; + break; // not enough characters left for a G1 Zx.x command } - ++buf; // move to 1 character beyond c + ++buf; // move to 1 character beyond c --len; + // In theory we should skip N and a line number here if they are present, but no slicers seem to generate line numbers if (c == 'G') { if (inRelativeMode) { + // We have seen a G91 in this buffer already, so we are only interested in G90 commands that switch back to absolute mode if (buf[0] == '9' && buf[1] == '0' && (buf[2] < '0' || buf[2] > '9')) { // It's a G90 command so go back to absolute mode @@ -943,11 +955,10 @@ bool PrintMonitor::FindHeight(const char* buf, size_t len, float& height) const // It is a G0 or G1 command. See if it has a Z parameter. while (len >= 4) { - c = *buf++; - --len; + c = *buf; if (c == 'Z') { - const char* zpos = buf; + const char* zpos = buf + 1; // Check special case of this code ending with ";E" or "; E" - ignore such codes while (len > 2 && *buf != '\n' && *buf != '\r' && *buf != ';') { @@ -969,6 +980,8 @@ bool PrintMonitor::FindHeight(const char* buf, size_t len, float& height) const { break; // no Z parameter } + ++buf; + --len; } } } diff --git a/src/Storage/FileStore.h b/src/Storage/FileStore.h index 7f841473..3bc0acaa 100644 --- a/src/Storage/FileStore.h +++ b/src/Storage/FileStore.h @@ -4,7 +4,7 @@ #define FILESTORE_H #include "Core.h" -#include "ff.h" +#include "Libraries/Fatfs/ff.h" typedef uint32_t FilePosition; const FilePosition noFilePosition = 0xFFFFFFFF; |