diff options
author | David Crocker <dcrocker@eschertech.com> | 2020-05-27 23:06:57 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2020-05-27 23:06:57 +0300 |
commit | abb62a3aee28addfce053d6f0d9c82d85160c595 (patch) | |
tree | e3cfb1698c0262ec52a2b9c9a2ed3015dfe7e72b /src/Storage | |
parent | 4082db3e809db86a06cb9d807f21cf1d377bc948 (diff) |
Various
Bug fix: fix filament needed array overflow when then GCode file
contains a filament used comment line with too many values
Adjust the number of stepper drivers on Duet 2 if a 12864 display is
configured
Changed step pulse code to not use paralell write because those are not
available on the 5LC board (or on LPC-based boards)
Changed 12864 LCD pin allocations for Duet NG
Removed calls to SafeStrtoul from BinaryParser and IoPorts
Diffstat (limited to 'src/Storage')
-rw-r--r-- | src/Storage/FileInfoParser.cpp | 4 | ||||
-rw-r--r-- | src/Storage/FileInfoParser.h | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/Storage/FileInfoParser.cpp b/src/Storage/FileInfoParser.cpp index 2380e78d..56ef3ad8 100644 --- a/src/Storage/FileInfoParser.cpp +++ b/src/Storage/FileInfoParser.cpp @@ -21,6 +21,7 @@ FileInfoParser::FileInfoParser() noexcept parserMutex.Create("FileInfoParser"); } +// This following method needs to be called repeatedly until it returns true - this may take a few runs bool FileInfoParser::GetFileInfo(const char *filePath, GCodeFileInfo& info, bool quitEarly) noexcept { MutexLocker lock(parserMutex, MAX_FILEINFO_PROCESS_TIME); @@ -93,7 +94,6 @@ bool FileInfoParser::GetFileInfo(const char *filePath, GCodeFileInfo& info, bool const uint32_t loopStartTime = millis(); do { - char* const buf = reinterpret_cast<char*>(buf32); size_t sizeToRead, sizeToScan; // number of bytes we want to read and scan in this go switch (parseState) @@ -646,7 +646,7 @@ unsigned int FileInfoParser::FindFilamentUsed(const char* buf, size_t len) noexc { ++p; // this allows for " = " from default slic3r comment and ": " from default Cura comment } - while (isDigit(*p)) + while (isDigit(*p) && filamentsFound < maxFilaments) { const char* q; float filamentLength = SafeStrtof(p, &q); diff --git a/src/Storage/FileInfoParser.h b/src/Storage/FileInfoParser.h index dcaf16e9..330340aa 100644 --- a/src/Storage/FileInfoParser.h +++ b/src/Storage/FileInfoParser.h @@ -44,7 +44,7 @@ class FileInfoParser public: FileInfoParser() noexcept; - // The following method needs to be called until it returns true - this may take a few runs + // The following method needs to be called repeatedly until it returns true - this may take a few runs bool GetFileInfo(const char *filePath, GCodeFileInfo& info, bool quitEarly) noexcept; static constexpr const char* SimulatedTimeString = "\n; Simulated print time"; // used by FileInfoParser and MassStorage @@ -75,7 +75,7 @@ private: // We used to allocate the following buffer on the stack; but now that this is called by more than one task // it is more economical to allocate it permanently because that lets us use smaller stacks. // Alternatively, we could allocate a FileBuffer temporarily. - uint32_t buf32[(GCODE_READ_SIZE + GCODE_OVERLAP_SIZE + 3)/4 + 1]; // buffer must be 32-bit aligned for HSMCI. We need the +1 so we can add a null terminator. + alignas(4) char buf[GCODE_READ_SIZE + GCODE_OVERLAP_SIZE + 1]; // buffer must be 32-bit aligned for HSMCI. We need the +1 so we can add a null terminator. }; #endif |