Forum Replies Created
Viewing 2 posts - 1 through 2 (of 2 total)
-
AuthorPosts
-
Renzo,
Thank you very much, that fixed it – dumb mistake on my part.
Thanks for the great software and the great help !
Hi, thanks for replying.
Setup:
#define DEFAULT_STORAGE_TYPE_ESP32 STORAGE_LITTLEFS #include <SimpleFtpServer.h> FtpServer ftpSrv; void setup() { Serial.begin(115200); if (!LittleFS.begin(FORMAT_LITTLEFS_IF_FAILED)) { Serial.println("LittleFS Mount Failed"); } else { Serial.println("LittleFS Mounted OK"); } delay(3000); }
Code to create test file and list FS contents:
void updateTestFile(String data) { if (!LittleFS.exists("/ign_log.txt")) { File file = LittleFS.open("/ign_log.txt", FILE_WRITE); if (!file) { Serial.println("There was an error opening ign_log.txt for writing"); return; } file.close(); } File file = LittleFS.open("/ign_log.txt", FILE_APPEND); if (!file) { Serial.println("- failed to open file for appending"); return; } if (file.print(data)) { Serial.println("- data appended"); } else { Serial.println("- append failed"); } file.close(); getFileList(); } void getFileList() { Serial.printf("Listing directory: %s\r\n", "/"); File root = LittleFS.open("/"); if (!root) { Serial.println("- failed to open directory"); return; } if (!root.isDirectory()) { Serial.println(" - not a directory"); return; } File file = root.openNextFile(); while (file) { if (file.isDirectory()) { Serial.print(" DIR : "); Serial.println(file.name()); // if (levels) // { // listDir(SPIFFS, file.path(), levels - 1); // } } else { Serial.print(" FILE: "); Serial.print(file.name()); Serial.print("\tSIZE: "); Serial.println(file.size()); } file = root.openNextFile(); } }
Then the loop:
ftpSrv.begin("abc","abc"); while (true) { ftpSrv.handleFTP(); }
getFileList() displays the test file and size on the serial console.
I then manually ftp to the device from a bash shell, connection and login are fine. Commands ‘dir’ and ‘ls’ give zero files.
Partition is default 4MB sith SPIFFS (12.MB APP, 1.5MB SPIFFS)
-
AuthorPosts
Viewing 2 posts - 1 through 2 (of 2 total)