diff options
author | David Crocker <dcrocker@eschertech.com> | 2019-05-25 12:26:08 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2019-05-25 12:26:08 +0300 |
commit | 73461819be81e0f8294a3810e644a9d88adf27d2 (patch) | |
tree | b201b55712de20b06fe96d97e43c80cd98af3b7e /src/Storage/MassStorage.cpp | |
parent | 07f1bd484874d7a3f0b85f40fc47bd9e9990c204 (diff) |
2.03RC3 provisional
Feature improvements/changed behaviour:
- M584 formatting improvement when no extruders
- In CoreNG, increment I2C reset count when resetting the I2C system
- Recognise filament usage comment in Prusa slicer
- G53 is now available even when workplace coordinates not supported in build (cancels tool offsets)
- For E3D: scale feed rate in proportion to total mix, for serial extruder drives etc.
- Allow M203 max speeds lower than 1mm/sec
- Enable laser in Duet085 build
- M563 P# with no other parameters: better response formatting when no heaters or no drives
- Added extra diagnostics for when a filename is too long
Bug fixes:
- Problem with leadscrew move when driver numbers >= MaxAxes are used to drive Z motors
- Added missing newline at end of some error messages
- M585 L parameter was not working
- In resume.g a G1 R command goes to the wrong coordinates if workplace coordinate offsets are being used
- Homing files when workplace coordinate offsets were active cause other axes to move
- Resurrect.g all coordinates need to be machine coordinates
- Resurrect.g restore workplace # and workplace offsets
- Error with babystepping: incorrect sign when doing tool offset inverse transform, so it restores an incorrect Z position
Diffstat (limited to 'src/Storage/MassStorage.cpp')
-rw-r--r-- | src/Storage/MassStorage.cpp | 51 |
1 files changed, 18 insertions, 33 deletions
diff --git a/src/Storage/MassStorage.cpp b/src/Storage/MassStorage.cpp index 302ca276..810ed4b3 100644 --- a/src/Storage/MassStorage.cpp +++ b/src/Storage/MassStorage.cpp @@ -144,47 +144,32 @@ void MassStorage::CloseAllFiles() /*static*/ void MassStorage::CombineName(const StringRef& outbuf, const char* directory, const char* fileName) { - outbuf.Clear(); - size_t outIndex = 0; - size_t inIndex = 0; - - // DC 2015-11-25 Only prepend the directory if the filename does not have an absolute path or volume specifier - if (directory != nullptr && fileName[0] != '/' && (strlen(fileName) < 2 || !isdigit(fileName[0]) || fileName[1] != ':')) + bool hadError = false; + if (directory != nullptr && directory[0] != 0 && fileName[0] != '/' && (strlen(fileName) < 2 || !isdigit(fileName[0]) || fileName[1] != ':')) { - while (directory[inIndex] != 0 && directory[inIndex] != '\n') + hadError = outbuf.copy(directory); + if (!hadError) { - outbuf.Pointer()[outIndex] = directory[inIndex]; - inIndex++; - outIndex++; - if (outIndex >= outbuf.Capacity()) + const size_t len = outbuf.strlen(); + if (len != 0 && outbuf[len - 1] != '/') { - reprap.GetPlatform().MessageF(ErrorMessage, "CombineName() buffer overflow"); - outbuf.copy("?????"); - return; + hadError = outbuf.cat('/'); } } - - if (inIndex > 0 && directory[inIndex - 1] != '/') - { - outbuf.Pointer()[outIndex] = '/'; - outIndex++; - } - inIndex = 0; } - - while (fileName[inIndex] != 0 && fileName[inIndex] != '\n') + if (!hadError) { - if (outIndex >= outbuf.Capacity()) - { - reprap.GetPlatform().Message(ErrorMessage, "file name too long"); - outbuf.copy("?????"); - return; - } - outbuf.Pointer()[outIndex] = fileName[inIndex]; - inIndex++; - outIndex++; + hadError = outbuf.cat(fileName); + } + if (hadError) + { + reprap.GetPlatform().MessageF(ErrorMessage, "Filename too long: cap=%u, dir=%.12s%s name=%.12s%s\n", + outbuf.Capacity(), + directory, (strlen(directory) > 12 ? "..." : ""), + fileName, (strlen(fileName) > 12 ? "..." : "") + ); + outbuf.copy("?????"); } - outbuf.Pointer()[outIndex] = 0; } // Open a directory to read a file list. Returns true if it contains any files, false otherwise. |