palmerr23 / ESP32-OTA-and-File-Manager

An OTA and File management program for Arduino 2.x
39 stars 9 forks source link

File size limitation of 4kB #5

Open purehunter1 opened 8 months ago

purehunter1 commented 8 months ago

Hi palmerr23,

Firstly: I really appreciate your work in this project! It does exactly what I was looking for :-)

After implementation in my project, I found, that there is a file size limitation of about 4kB which is too low for my application. I need at least about 8kB. And this is not noted in the "Limitations".

To solve the problem, in a first step I thought, there is the line #define FILEBUFSIZ 4096 which I have just to modify to allocate more buffer. But when I increase this buffer, the program crashes immediately. No need to transmit data. Running on a ESP32-S2 with a low percentage of allocated RAM. After browsing the whole web for hours, I found, that there are limitations in the (synchronous) Arduino Webserver which I guess is the underlaying problem. But as an "Arduino Grade" programmer, it is out of reach for me to do anything on this level.

Do you have an idea how to improve this in your project? Or ist it possible to port this great project to an (async ?) webserver which is capable of handling bigger files? If there was a solution, it would lift this great project on the next level! :-)

purehunter

purehunter1 commented 8 months ago

Hi palmerr23,

after more investigation, I found that the limitation is the same when running only your original example which I'm referring to here. Even though there should be plenty of RAM, the program crashes.

I now made a try with the filebuf[FILEBUFSIZ] defined as a global variable - instead of the original local definition in handleMain() - AND:... as you terminate the written content with '\0' it works pretty well, even w/o an additional initialisation in handleMain() ! I'm not sure what the reason for this limitation is.

For the moment I will use it in this way. Thanks again!

purehunter

palmerr23 commented 8 months ago

Thanks for the feedback.

Yes, I have a version that works with Async, however it is embedded in another program.

I've used it to upload files of 16kB or more. It has only been tested on a PicoW at this point.

I've put the relevant files n the PICOW_Async_New folder, if you care to experiment.