diff options
author | David Crocker <dcrocker@eschertech.com> | 2021-08-13 18:40:06 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2021-08-13 18:40:06 +0300 |
commit | 5fe5917ceb4e00353f7b398dd0b5167a182c1192 (patch) | |
tree | 1e8bbc66948fbd510da2a982a25cb20f2d1a078e /src/Storage/FileInfoParser.cpp | |
parent | 53ce4b3eb1acbf0dcecaeeae6d4cc4d18dc7fb2d (diff) |
Resolved some missing functions wheh HAS_EMBEDDED_FILES is true
Diffstat (limited to 'src/Storage/FileInfoParser.cpp')
-rw-r--r-- | src/Storage/FileInfoParser.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/Storage/FileInfoParser.cpp b/src/Storage/FileInfoParser.cpp index 56681ab0..710a2d88 100644 --- a/src/Storage/FileInfoParser.cpp +++ b/src/Storage/FileInfoParser.cpp @@ -12,7 +12,7 @@ #include <PrintMonitor/PrintMonitor.h> #include <GCodes/GCodes.h> -#if HAS_MASS_STORAGE +#if HAS_MASS_STORAGE || HAS_EMBEDDED_FILES FileInfoParser::FileInfoParser() noexcept : parseState(notParsing), fileBeingParsed(nullptr), accumulatedParseTime(0), accumulatedReadTime(0), accumulatedSeekTime(0), fileOverlapLength(0) @@ -68,7 +68,9 @@ GCodeResult FileInfoParser::GetFileInfo(const char *filePath, GCodeFileInfo& inf // Set up the info struct parsedFileInfo.Init(); parsedFileInfo.fileSize = fileBeingParsed->Length(); +#if HAS_MASS_STORAGE parsedFileInfo.lastModifiedTime = MassStorage::GetLastModifiedTime(filePath); +#endif parsedFileInfo.isValid = true; // Record some debug values here @@ -198,6 +200,7 @@ GCodeResult FileInfoParser::GetFileInfo(const char *filePath, GCodeFileInfo& inf case seeking: // Seeking into a large file can take a long time using the FAT file system, so do it in stages { +#if HAS_MASS_STORAGE FilePosition currentPos = fileBeingParsed->Position(); const uint32_t clsize = fileBeingParsed->ClusterSize(); if (currentPos/clsize > nextSeekPos/clsize) @@ -205,12 +208,14 @@ GCodeResult FileInfoParser::GetFileInfo(const char *filePath, GCodeFileInfo& inf // Seeking backwards over a cluster boundary, so in practice the seek will start from the start of the file currentPos = 0; } - // Seek at most 512 clusters at a time const FilePosition maxSeekDistance = 512 * (FilePosition)clsize; const bool doFullSeek = (nextSeekPos <= currentPos + maxSeekDistance); const FilePosition thisSeekPos = (doFullSeek) ? nextSeekPos : currentPos + maxSeekDistance; - +#elif HAS_EMBEDDED_FILES + const bool doFullSeek = true; + const FilePosition thisSeekPos = nextSeekPos; +#endif const uint32_t startTime = millis(); if (!fileBeingParsed->Seek(thisSeekPos)) { |