Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LittleFSSample fails to compile #20

Open
Andy2051 opened this issue Mar 8, 2022 · 7 comments
Open

LittleFSSample fails to compile #20

Andy2051 opened this issue Mar 8, 2022 · 7 comments

Comments

@Andy2051
Copy link

Andy2051 commented Mar 8, 2022

Title says it all, get exactly the same errors when trying to use FTPClientServer in my own project.

In file included from /home/andy/Arduino/libraries/FTPClientServer-master/FTPServer.h:32, from /home/andy/Arduino/sketches/LittleFSSample/LittleFSSample.ino:24: /home/andy/Arduino/libraries/FTPClientServer-master/FTPCommon.h:11:7: error: 'esp8266Pool' has not been declared 11 | using esp8266Pool::polledTimeout::oneShotMs; // import the type to the local namespace | ^~~~~~~~~~~ In file included from /home/andy/Arduino/libraries/FTPClientServer-master/FTPServer.h:32, from /home/andy/Arduino/sketches/LittleFSSample/LittleFSSample.ino:24: /home/andy/Arduino/libraries/FTPClientServer-master/FTPCommon.h:130:5: error: 'oneShotMs' does not name a type 130 | oneShotMs aTimeout; // timeout from esp8266 core library | ^~~~~~~~~ exit status 1 Error compiling for board NodeMCU 1.0 (ESP-12E Module).

@maxint-rd
Copy link

maxint-rd commented Mar 11, 2022

Same here. FTPServerSample/LittleFSSample, gives same error using ESP8266 core 3.0.2 in Arduino IDE 1.8.16.

Tested fix by this pull request: #19
After changing esp8266compat/PolledTimeout.h the example compiles.

  • Serial console properly lists directory contents.

  • FileZilla (3.48.1) makes connection, but doesn't show directory contents. (Even though I did set max. connections to 1).
    After restart directories and files are shown, but downloading failed.

  • Windows 7 file explorer: ftp://ftp:ftp@ works somewhat:
    Connection properly made, directories under root / properly listed
    Copying all files at once to local directory fails with ESP8266 exception: Soft WDT reset
    Copying single small (6kB) file from root went fine. Copy larger file (55kB) also.
    Copying directory failed: [FTP] >>> 550 File "%s" not found.
    Change to subdirectory failed: FTP browser still lists root. Can't change using either url or click in browser.
    (console shows success, but not really:

[FTP] processing: command CWD [445743], params='/mml/test/txt/' (cwd='/')
[FTP] >>> 250 Directory successfully changed. 
[FTP] processing: command TYPE [45505954], params='A' (cwd='/')
  • Windows 7, cmd -> ftp fails:
    FTP can login (using example user/pwd ftp/ftp), status info in console
    ls command gives "425 No data connection"
    pwd command gives "500 unknown command "XPWD"
    bye command gives "221 Goodbye"

@Andy2051
Copy link
Author

Glad to know it's not just me, if you find a working fix please post what you did. I dumped FTPClientServer in favour of SimpleFTPserver, that works with littleFS. Originally I was using ESP8266FtpServer but making the switch SPIFFS to LittleFS and SPIFFS is hardwired into ESP8266FtpServer.

@maxint-rd
Copy link

The fix in pull request #19 made the example compile. All that was needed was to use the changed file (or copy the changes).
After testing various FTP programs I wasn't quite satisfied (see above). Thank you for your suggestion. I'll have a look at it.

In my ESP8266 project I'm using the excellent WiFiManager library. along with code from the very nice ESP8266Webserver/FSBrowser example and was looking for an easy way to copy multiple files at once from the LittleFS file system to back-up all files that I changed using the fsbrower editor.

@Andy2051
Copy link
Author

Can you be explicit about what you did? I read the link and couldn't see the fix.
I read

I kept the namespace the same, just changed the include guards to "#pragma once."

But it didn't mean anything for me.

and was looking for an easy way to copy multiple files at once from the LittleFS file system to back-up all files that I changed using the fsbrower editor.

SimpleFTPserver will not do that for you, you need an FTP client. That is why I was looking at FTPClientServer. For a previous project I wrote one for myself (improving what someone else had done) so I could ftp files from the esp8266 to my NAS. It's in one of my previous posts - not a regular contributor to this forum, so don't know if you can search "user's posts".

@maxint-rd
Copy link

If you look here you can see the .h file needs two changes:

  • remove the #ifdef #define at top and the #endif at end
  • add the #pragma at top

Thank you for your suggestion to make the ESP have an automatic backup feature by using it as an ftp-client. My own thought was to simply make it a server to allow a client on windows to copy (download) a bunch of files.

This afternoon I tested the SimpleFtpServer example. Some things worked better, but unfortunately I still had similar issues, making me wonder there's something wrong in my setup. I guess further testing is needed (different clients, other hardware, etc)...

@maxint-rd
Copy link

Did some more testing with SimpleFtpServer and found that in the Windows 7 ftp.exe a directory listing would show incomplete lines. After much debugging I saw that the filename pointer was taken directly as c_str() from dir.fileName(), The buffer of that String apparently would no longer be available after the subsequent call to dir.fileTime(). This caused the generateFileLine() call to use invalid data. After fixing that using an intermediate String variable, the Windows FTP explorer successfully was able to copy a whole folder. I still had problems using FileZilla, but at least it's now easier for me to download a copy of all files on the ESP.

BTW. I post this here because those issues may be related to the ones I encountered when testing the LittleFSSample in this library.

@Andy2051
Copy link
Author

Can't help, six years since I ran win natively, linux user :)

For reference, this is the ftpclient I did:
https://forum.arduino.cc/t/arduino-esp8266-nodemcu-ftp-client/567765

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants