diff options
author | David Crocker <dcrocker@eschertech.com> | 2019-02-23 17:23:47 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2019-02-23 17:23:47 +0300 |
commit | 147cf48293f63abf4a9ba4129062a93a29ce33ec (patch) | |
tree | 9dc1171fefbd8fcca65b7e08fa44470dbf1a9a75 /src/Storage/FileStore.cpp | |
parent | 9f17c4ebd2e1c24a8bf3fb095c214c256de42ca5 (diff) |
Towards 2.03beta3
Implemented M505
Implemented baby stepping on all axes, but only Z babysteps get accelerated by pushing them through the move queue
Increased max heaters per tool and extruders per tool to 8 in Duet NG build
Bug fix: when a file to print was selected on the 12864 display, the wrong file could be started if there were filename entries star4ting with '.'
Bug fix: disable limit checking on special moves, even on CNC and Laser machines
Fix DuetNG configuration build errors when smart driver support is turned off
Diffstat (limited to 'src/Storage/FileStore.cpp')
-rw-r--r-- | src/Storage/FileStore.cpp | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/src/Storage/FileStore.cpp b/src/Storage/FileStore.cpp index b727180e..190724d9 100644 --- a/src/Storage/FileStore.cpp +++ b/src/Storage/FileStore.cpp @@ -54,36 +54,34 @@ bool FileStore::IsOpenOn(const FATFS *fs) const // Open a local file (for example on an SD card). // This is protected - only Platform can access it. -bool FileStore::Open(const char* directory, const char* fileName, OpenMode mode, uint32_t preAllocSize) +bool FileStore::Open(const char* filePath, OpenMode mode, uint32_t preAllocSize) { - String<MaxFilenameLength> location; - MassStorage::CombineName(location.GetRef(), directory, fileName); const bool writing = (mode == OpenMode::write || mode == OpenMode::append); writeBuffer = nullptr; if (writing) { // Try to create the path of this file if we want to write to it - String<MaxFilenameLength> filePath; - filePath.copy(location.c_str()); + String<MaxFilenameLength> filePathCopy; + filePathCopy.copy(filePath); - size_t i = (isdigit(filePath[0]) && filePath[1] == ':') ? 2 : 0; - if (filePath[i] == '/') + size_t i = (isdigit(filePathCopy[0]) && filePathCopy[1] == ':') ? 2 : 0; + if (filePathCopy[i] == '/') { ++i; } - while (i < filePath.strlen()) + while (i < filePathCopy.strlen()) { - if (filePath[i] == '/') + if (filePathCopy[i] == '/') { - filePath[i] = 0; - if (!reprap.GetPlatform().GetMassStorage()->DirectoryExists(filePath.GetRef()) && !reprap.GetPlatform().GetMassStorage()->MakeDirectory(filePath.c_str())) + filePathCopy[i] = 0; + if (!reprap.GetPlatform().GetMassStorage()->DirectoryExists(filePathCopy.GetRef()) && !reprap.GetPlatform().GetMassStorage()->MakeDirectory(filePathCopy.c_str())) { - reprap.GetPlatform().MessageF(ErrorMessage, "Failed to create folder %s while trying to open file %s\n", filePath.c_str(), location.c_str()); + reprap.GetPlatform().MessageF(ErrorMessage, "Failed to create folder %s while trying to open file %s\n", filePathCopy.c_str(), filePath); return false; } - filePath[i] = '/'; + filePathCopy[i] = '/'; } ++i; } @@ -98,7 +96,7 @@ bool FileStore::Open(const char* directory, const char* fileName, OpenMode mode, } } - const FRESULT openReturn = f_open(&file, location.c_str(), + const FRESULT openReturn = f_open(&file, filePath, (mode == OpenMode::write) ? FA_CREATE_ALWAYS | FA_WRITE : (mode == OpenMode::append) ? FA_READ | FA_WRITE | FA_OPEN_ALWAYS : FA_OPEN_EXISTING | FA_READ); @@ -114,7 +112,7 @@ bool FileStore::Open(const char* directory, const char* fileName, OpenMode mode, // It is up to the caller to report an error if necessary. if (reprap.Debug(modulePlatform)) { - reprap.GetPlatform().MessageF(WarningMessage, "Failed to open %s to %s, error code %d\n", location.c_str(), (writing) ? "write" : "read", (int)openReturn); + reprap.GetPlatform().MessageF(WarningMessage, "Failed to open %s to %s, error code %d\n", filePath, (writing) ? "write" : "read", (int)openReturn); } return false; } |