diff --git a/Grbl_Esp32/src/Error.cpp b/Grbl_Esp32/src/Error.cpp index 34dd1cd4..5fc653d0 100644 --- a/Grbl_Esp32/src/Error.cpp +++ b/Grbl_Esp32/src/Error.cpp @@ -80,4 +80,13 @@ std::map ErrorNames = { { Error::NvsGetStatsFailed, "Failed to get setting status" }, { Error::AuthenticationFailed, "Authentication failed!" }, { Error::AnotherInterfaceBusy, "Another interface is busy"}, + { Error::FsFailedMount, "Local FS failed mount" }, + { Error::FsFailedRead, "Local FS failed read" }, + { Error::FsFailedOpenDir, "Local FS failed to open directory" }, + { Error::FsDirNotFound, "Local FS directory not found" }, + { Error::FsFileEmpty, "Local FS file empty" }, + { Error::FsFileNotFound, "Local FS file not found" }, + { Error::FsFailedOpenFile, "Local FS failed to open file" }, + { Error::FsFailedDelDir, "Local FS failed to delete directory" }, + { Error::FsFailedDelFile, "Local FS failed to delete file" }, }; diff --git a/Grbl_Esp32/src/Error.h b/Grbl_Esp32/src/Error.h index 80f40a39..00f32997 100644 --- a/Grbl_Esp32/src/Error.h +++ b/Grbl_Esp32/src/Error.h @@ -84,6 +84,15 @@ enum class Error : uint8_t { AuthenticationFailed = 110, Eol = 111, AnotherInterfaceBusy = 120, + FsFailedMount = 130, // Local FS Failed to mount + FsFailedRead = 131, // Local FS Failed to read file + FsFailedOpenDir = 132, // Local FS failed to open directory + FsDirNotFound = 133, // Local FS directory not found + FsFileEmpty = 134, // Local FS directory not found + FsFileNotFound = 135, // Local FS file not found + FsFailedOpenFile = 136, // Local FS failed to open file + FsFailedDelDir = 138, // Local FS failed to delete dir + FsFailedDelFile = 139, // Local FS failed to delete file }; extern std::map ErrorNames; diff --git a/Grbl_Esp32/src/WebUI/WebSettings.cpp b/Grbl_Esp32/src/WebUI/WebSettings.cpp index 5a1e03dc..76f6823b 100644 --- a/Grbl_Esp32/src/WebUI/WebSettings.cpp +++ b/Grbl_Esp32/src/WebUI/WebSettings.cpp @@ -302,11 +302,11 @@ namespace WebUI { } if (!SPIFFS.exists(path)) { webPrintln("Error: No such file!"); - return Error::SdFileNotFound; + return Error::FsFileNotFound; } File currentfile = SPIFFS.open(path, FILE_READ); if (!currentfile) { //if file open success - return Error::SdFailedOpenFile; + return Error::FsFailedOpenFile; } //until no line in file Error err; @@ -338,11 +338,11 @@ namespace WebUI { } if (!SPIFFS.exists(path)) { webPrintln("Error: No such file!"); - return Error::SdFileNotFound; + return Error::FsFileNotFound; } File currentfile = SPIFFS.open(path, FILE_READ); if (!currentfile) { - return Error::SdFailedOpenFile; + return Error::FsFailedOpenFile; } while (currentfile.available()) { // String currentline = currentfile.readStringUntil('\n'); @@ -810,13 +810,11 @@ namespace WebUI { //char temp_filename[128]; // to help filter by extension TODO: 128 needs a definition based on something File root = fs.open(dirname); if (!root) { - //FIXME: need proper error for FS and not usd sd one - report_status_message(Error::SdFailedOpenDir, client); + report_status_message(Error::FsFailedOpenDir, client); return; } if (!root.isDirectory()) { - //FIXME: need proper error for FS and not usd sd one - report_status_message(Error::SdDirNotFound, client); + report_status_message(Error::FsDirNotFound, client); return; } File file = root.openNextFile();