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

LittleFS #1

Open
roncoa opened this issue Mar 2, 2020 · 9 comments
Open

LittleFS #1

roncoa opened this issue Mar 2, 2020 · 9 comments

Comments

@roncoa
Copy link

roncoa commented Mar 2, 2020

Can you update DevFsUpload to use with LittleFS?

@DaveBrad
Copy link
Owner

I'm looking into LittleFS on three fronts.

  1. have it coexist with SPIFFS code and be select-able for compile (some issues around this) so as to maintain a low ram foot-print.
  2. Consider creating a DevFsUploadLittleFS sibliing library (if 1 does not work)
  3. SPIFFS has a flat dir/file structure. Whereas LittleFS supports a directory/folder structure (with mkdir,....) and files [implying more methods to support and larger ram foot-print]

I'm looking at it and hopefully have a solution within a week or so.

@roncoa
Copy link
Author

roncoa commented Mar 10, 2020

Thanks for your answer.
Waiting for your solution, I modified your library to make it work with LittleFS.
If it can be useful, I have:
_ I replaced #include "FS.h" with include "LittleFS.h".

#include "LittleFS.h"
// # include "FS.h"

_ I replaced all the SPIFFS calls with LittelFS.
_ I added the function "static void listDir (const char * dirname, WiFiClient client);"

void DevFsUpload :: listDir (const char * dirname, WiFiClient client) {
  Dir root = LittleFS.openDir (dirname);
  while (root.next ()) {
    if (root.fileSize ()) {
      File filee = root.openFile ("r");
String str = "<div>" + (String) filee.fullName () + "" + (String) filee.size () + "</div>";
cliente.println (str);
      filee.close ();
    }
    else {
      String tmp = root.fileName ();
      const char * tmp1 = tmp.c_str ();
      DevFsUpload :: listdir (tmp1, customer);
    }
  }
}

_ In "void DevFsUpload :: handleUploadPage ()" I substitute:

client.print ("<div class = 'scrl' tabindex = '- 1'> <div id = 'lsttab' class = 'bof dvtb'>");
Dir dir = LittleFS.openDir ("/");
while (dir.next ()) {
String str = "<div>" + dir.fileName () + "" + dir.fileSize () + "</div>";
//
// The above information will be changed to the following via a javascript client 'onload'
//
// String str = "<form class = 'frmRow' method = 'post'> <div class = 'tdi'> <input type = 'text' name = 'fname' readonly value = '";
// str + = dir.fileName ();
// str + = "'size ='";
// str + = len;
// str + = "'> </div> <div class =' ​​tdi siz '>";
// str + = dir.fileSize ();
// str + = "</div> <div class = 'tdi'> <input class = 'btt' type = 'submit' name = 'delete' value = 'Delete'> </div>";
// str + = "</form>";
client.println (str);
}
client.print ( "</ div> </ div> ');

with

client.print ("<div class = 'scrl' tabindex = '- 1'> <div id = 'lsttab' class = 'bof dvtb'>");
DevFsUpload :: listdir ( "/", client);
client.print ( "</ div> </ div> ');

@roncoa
Copy link
Author

roncoa commented Mar 10, 2020

Since LittleSF also supports filenames> 8.3, in void DevFsUpload :: handleFileUpload () I also commented on these lines:

	//  if(fnLen > 12){
	//	// this could be a directory upload item
	//	int remaining = fnLen - fn.lastIndexOf("/") - 1;
	//	failDirFormat = remaining > 12;
	//	Serial.print("remaining ");
	//	Serial.println(remaining);
	// }

@roncoa
Copy link
Author

roncoa commented Mar 10, 2020

I hope to be useful.
I look forward to your final version.
Thank you.

@DaveBrad
Copy link
Owner

I've a working LittleFS copy (my PC) but had to do more research than I expected. (LittleFS has an undocumented API and I had to guess/trial-and-error my way to a solution.) Support for directories is implemented; a few surprises in directory implementation.

I just need to sync with SPIFFS code so as to make the design similar. Plus need updated documentation for both SPIFFS and LittleFS so as to reflect the differences.

Unfortunately I have to "clone/duplicate" code from SPIFFS to LittleFS as a selector/preprocessor solution isn't possible with Arduiino IDE.

Hopefully will be done in the next few days.

@roncoa
Copy link
Author

roncoa commented Apr 4, 2020

Perfect.
I look forward to the new library.

@DaveBrad
Copy link
Owner

Try DaveBrad/DevFsUploadESP , it has documentation and provides more capability in managing files and directories on the ESP32 & ESP8266.
Configs support are:
ESP8266 - SPIFFS and LittleFS
ESP32 - SPIFFS

At present LittleFS on ESP32 is in flux or poorly supported.

Sorry it took so long: had to do code optimization to reduce the PROGMEM and Variable stack storage usage.

@roncoa
Copy link
Author

roncoa commented Apr 20, 2020

I'm trying it, it's excellent.
I have a request, could you add a "DOWNLOAD" button?
How does it work with ajax commands?
Anyway, you did a great job, very good.

@DaveBrad
Copy link
Owner

DaveBrad commented Apr 21, 2020 via email

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