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
This commit is contained in:
David Crocker 2016-08-20 18:07:07 +01:00
parent ed40658c45
commit 84a274f748
4 changed files with 24 additions and 20 deletions

View file

@ -102,9 +102,6 @@
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/Duet}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/Duet/Lwip}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/Duet/EMAC}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/Libraries/Fatfs}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/Libraries/MCP4461}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/Libraries/Flash}&quot;"/>
</option>
<option id="gnu.cpp.compiler.option.preprocessor.def.1548770846" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" useByScannerDiscovery="false" valueType="definedSymbols">
<listOptionValue builtIn="false" value="__SAM3X8E__"/>
@ -222,9 +219,6 @@
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${CoreName}/variants/duetNG}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/DuetNG}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/Libraries/Fatfs}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/Libraries/MCP4461}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/Libraries/Flash}&quot;"/>
</option>
<option id="gnu.cpp.compiler.option.preprocessor.def.1610427238" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" useByScannerDiscovery="false" valueType="definedSymbols">
<listOptionValue builtIn="false" value="__SAM4E8E__"/>
@ -344,9 +338,6 @@
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${CoreName}/variants/duetNG}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/DuetNG}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/Libraries/Fatfs}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/Libraries/MCP4461}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/Libraries/Flash}&quot;"/>
</option>
<option id="gnu.cpp.compiler.option.preprocessor.def.486383061" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" useByScannerDiscovery="false" valueType="definedSymbols">
<listOptionValue builtIn="false" value="__SAM4E8E__"/>

View file

@ -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"

View file

@ -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
--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;
}
}
}

View file

@ -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;