Skip to content
This repository has been archived by the owner on Feb 4, 2023. It is now read-only.

Ethernet_Large + Lib Patches give always IP:255.255.255.255 || can not server.streamFile () from SPIFFS #19

Closed
ArminPP opened this issue Dec 26, 2020 · 1 comment

Comments

@ArminPP
Copy link

ArminPP commented Dec 26, 2020

Hello,
I'm trying to set up a web server with a W5500 Shield (and a m5Stack).
Since I use Bootstrap and the files are> 40 kB (up to 200 kB) I used the Ethernet_Large Library.
Without your lib patches, the html part loads, but the ESP crashes with the large css + js files.
When I import your lib patches, I only get IP: 255.255.255.255 addresses, regardless of whether I choose static or dynamic. (If I use the original Ethernet_large sources again, I get the correct IP address)

Unfortunately loading SPIFFS doesn't work with your library:

  File file = SPIFFS.open ("/bootstrap.min.css.gz", "r");
  size_t sent = server.streamFile (file, "text/css");

so I added another library:
Effortless_SPIFFS.h https://github.com/thebigpotatoe/Effortless-SPIFFS
This loads the files stored in SPIFFS into a string at lightning speed, which I then transfer to your lib:
Unfortunately the Effortless_SPIFFS doesn't load and extract .gz files (which will server.streamFile() do and server.send() not, I presume ), so I have to use the uncompressed ones ...

bool handleFileRead (String path) {
  String sHTML;
  char cPath [20];
  if (path.endsWith ("/")) path + = "index.html";
  if (SPIFFS.exists (path)) {
    path.toCharArray (cPath, 20);
    String contentType = getContentType (path);
    fileSystem.openFromFile (cPath, sHTML); // <- Effortless_SPIFFS.h
    server.send(200, contentType, sHTML);
    return true;
  }
  return false;
}

Is it possible, to load Files large than >40 kb from SPIFFS and send it to server() - directly with Ethernet_Large, and server.streamFile() or with server.send() ?

Thank you verry much,,
Armin

@khoih-prog
Copy link
Owner

Congrats on your project's quick advancement.

There are many known issues with ESP32 and W5x00 libraries, relating to SPIFFS as you can see in Spiffs not work.

There is also the possible problems caused by the Ethernetx libraries on which this EthernetWebServer library is relying. Also keep in mind that these libraries and MCUs, even ESP32, have limited capability and can't be expected to work as fast and good as the PCs.

I'm sure that the patched EthernetLarge library is working OK. The IP: 255.255.255.255 issue is caused by something in your code. Test using one of the examples to know for sure and compare. If you can provide some code the duplicate this IP issue, I can help you there.

I just can suggest you test step-by-step

  1. Change the Ethernet library to Ethernet2, Ethernet3
  2. Use the Ethernetx libraries directly to isolate where the problem is.
  3. Using native ESP32 WiFi for your application
  4. Try new ESP32 LittleFS instead of slower and to-be-deprecated SPIFFS
  5. Using SD card instead of SPIFFS/LittleFS
  6. Conflict on SPI bus

image

There is no way I can help you solve this problem without much info or code to duplicate the issue.

I'll close the issue now as it seems to me that the problem is caused be other libraries / configuration / core.

Good Luck,

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

No branches or pull requests

2 participants