From 341c4b534347301733c97c6cf95198bc072d9491 Mon Sep 17 00:00:00 2001 From: Daniel Plasa Date: Sun, 31 May 2020 18:38:42 +0200 Subject: add docu on esp32 --- README.md | 14 ++++++-------- examples/FTPServerSample/LittleFSSample/LittleFSSample.ino | 3 ++- examples/FTPServerSample/SPIFFSSample/SPIFFSSample.ino | 8 +++++--- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 72b575a..fec125b 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ # FTPServer and FTPClient -Simple FTP Server and Client for the esp8266/esp32 with LittleFS and SPIFFS support. +Simple FTP Server and Client for the esp8266/esp32 with SPIFFS and LittleFS support. -I've modified a FTP Server from arduino/wifi shield to work with the esp826. It should also work on the esp32. LittleFS with directory handling is supported since SPIFFS has been marked deprecated. -This allows you to FTP into your esp8266/esp32 and access/modify the LittleFS/SPIFFS folder/data. -I've tested it with Filezilla, and it works (upload/download/rename/delete). There's no create/modify directory support in SPIFFS but in LittleFS there is! +I've modified a FTP Server from arduino/wifi shield to work with the esp8266 and the esp32. This allows you to FTP into your esp8266/esp32 and access/modify files and directories on the FS. SPIFFS's approach to directories is somewhat limited (everything is a file albeit it's name may contain '/'-es). LittleFS (which is not yet available for the esp32) however has full directory support. +So with a FTP Server working on SPIFFS there will be no create/modify directory support but with LittleFS there is! +The code ist tested it with command line ftp and Filezilla. The FTP Client is pretty much straight forward. It can upload (put, STOR) a file to a FTP Server or download (get, RETR) a file from a FTP Server. Both ways can be done blocking or non-blocking. @@ -17,12 +17,12 @@ The FTP Client is pretty much straight forward. It can upload (put, STOR) a file when accessing files. ## Limitations -* Server only allows **one** ftp control and **one** data connection at a time. You need to setup Filezilla (or other clients) to respect that, i.e. only allow **1** connection. (In FileZilla go to File/Site Manager then select your site. In Transfer Settings, check "Limit number of simultaneous connections" and set the maximum to 1.) This limitation is also the reason why FuseFS using clients (e.g. curlftpfs) seem to work (i.e. listing directories) but will fail on file operations as they try to open a second control connection for that. +* Server only allows **one** ftp control and **one** data connection at a time. You need to setup Filezilla (or other clients) to respect that, i.e. only allow **1** connection. (In FileZilla go to File/Site Manager then select your site. In Transfer Settings, check "Limit number of simultaneous connections" and set the maximum to 1.) This limitation is also the reason why FuseFS based clients (e.g. curlftpfs) seem to work (i.e. listing directories) but will fail on file operations as they try to open a second control connection for that. * It does not yet support encryption ## Compatibility -This library was tested against the 2.7.1 version of the esp8266 Arduino core library. +This library was tested against the 2.7.1 version of the esp8266 Arduino core library and the 1.0.4 version of the esp32 Arduino core. ## Server Usage @@ -68,8 +68,6 @@ FTPClient ftpClient(SPIFFS); // construct with SPIFFS if you need to for backw // String password; // String servername; // uint16_t port; -// bool authTLS = false; -// bool validateCA = false; // }; ServerInfo ftpServerInfo ("username", "password", "server_name_or_ip", 21); diff --git a/examples/FTPServerSample/LittleFSSample/LittleFSSample.ino b/examples/FTPServerSample/LittleFSSample/LittleFSSample.ino index d30120b..4a02754 100644 --- a/examples/FTPServerSample/LittleFSSample/LittleFSSample.ino +++ b/examples/FTPServerSample/LittleFSSample/LittleFSSample.ino @@ -22,6 +22,7 @@ #include #include #include +#define BAUDRATE 74880 const char *ssid PROGMEM = "YOUR_SSID"; const char *password PROGMEM = "YOUR_PASS"; @@ -31,7 +32,7 @@ FTPServer ftpSrv(LittleFS); void setup(void) { - Serial.begin(74880); + Serial.begin(BAUDRATE); WiFi.begin(ssid, password); bool fsok = LittleFS.begin(); diff --git a/examples/FTPServerSample/SPIFFSSample/SPIFFSSample.ino b/examples/FTPServerSample/SPIFFSSample/SPIFFSSample.ino index b15bd98..23bce4a 100644 --- a/examples/FTPServerSample/SPIFFSSample/SPIFFSSample.ino +++ b/examples/FTPServerSample/SPIFFSSample/SPIFFSSample.ino @@ -18,9 +18,11 @@ #if (defined ESP32) #include #include +#define BAUDRATE 115200 #elif (defined ESP8266) #include #include +#define BAUDRATE 74880 #endif #include @@ -34,7 +36,7 @@ FTPServer ftpSrv(SPIFFS); void setup(void) { - Serial.begin(74880); + Serial.begin(BAUDRATE); WiFi.begin(ssid, password); bool fsok = SPIFFS.begin(); @@ -72,7 +74,7 @@ void loop(void) ftpSrv.handleFTP(); // - // Code below just to debug in Serial Monitor + // Code below just for debugging in Serial Monitor // if (action == show) { @@ -112,7 +114,7 @@ void loop(void) uint16_t ListDir(const char *path) { uint16_t dirCount = 0; - Dir dir = SPIFFS.openDir(path); + Dir dir = SPIFFS.openDir(path, "r"); while (dir.next()) { ++dirCount; -- cgit v1.2.3