Arduino DUE and ESP8266 Webserver - Problems with Images
Posted: Wed Aug 11, 2021 2:34 pm
Hello,
I have the following problem:
I use an Arduino DUE together with an ESP8266 ESP-01S. I also use the following library https://github.com/khoih-prog/ESP8266_AT_WebServer.
This works so far. However I have problems with larger amounts of data of approx. more than 2000 characters (I don't know exactly where the limit is). I split the html source code into some PROGMEM variables and send all this one after the other.
server.send(200, "text/html", "");
server.sendContent_P(mpageHeader);
server.sendContent_P(mpageFaviconPart1);
server.sendContent_P(mpageFaviconPart2);
server.sendContent_P(mpageFaviconPart3);
server.sendContent_P(mpageFaviconPart4);
server.sendContent_P(mpageHeader2);
server.sendContent_P(mpageJavaScript);
server.sendContent_P(mpageButtonsPart1);
server.sendContent_P(mpageButtonsPart2);
server.sendContent_P(mpageFooter);
server.sendContent(F(""));
But this is quite slow if I also want to send an image (here e.g. the favicon is base64 encoded and splitted into 4 parts).
Whenever a part is too big, then the following is logged:
[ESP_AT] Client_write: Failed to write to socket 0
Actually I want to add a few png or so to the page, but I can forget that in this way.
I now have the following questions:
1. is it possible to send more than about 2000 characters without getting the error (Client_write: Failed to write to socket 0)?
2. is it possible to store files in the SPIFFS in the combination Arduino Due and ESP (with the NodeMCU this is possible)?
3. is there another library to address the ESP that works better?
Maybe these are stupid questions, sorry! This is my first major Arduino project where I can not use a small NodeMCU.
I've been sitting on it for 2 weeks and have already figured out a few things but I can't get any further.
It would be great if you have some tips for me.
Best regards!
I have the following problem:
I use an Arduino DUE together with an ESP8266 ESP-01S. I also use the following library https://github.com/khoih-prog/ESP8266_AT_WebServer.
This works so far. However I have problems with larger amounts of data of approx. more than 2000 characters (I don't know exactly where the limit is). I split the html source code into some PROGMEM variables and send all this one after the other.
server.send(200, "text/html", "");
server.sendContent_P(mpageHeader);
server.sendContent_P(mpageFaviconPart1);
server.sendContent_P(mpageFaviconPart2);
server.sendContent_P(mpageFaviconPart3);
server.sendContent_P(mpageFaviconPart4);
server.sendContent_P(mpageHeader2);
server.sendContent_P(mpageJavaScript);
server.sendContent_P(mpageButtonsPart1);
server.sendContent_P(mpageButtonsPart2);
server.sendContent_P(mpageFooter);
server.sendContent(F(""));
But this is quite slow if I also want to send an image (here e.g. the favicon is base64 encoded and splitted into 4 parts).
Whenever a part is too big, then the following is logged:
[ESP_AT] Client_write: Failed to write to socket 0
Actually I want to add a few png or so to the page, but I can forget that in this way.
I now have the following questions:
1. is it possible to send more than about 2000 characters without getting the error (Client_write: Failed to write to socket 0)?
2. is it possible to store files in the SPIFFS in the combination Arduino Due and ESP (with the NodeMCU this is possible)?
3. is there another library to address the ESP that works better?
Maybe these are stupid questions, sorry! This is my first major Arduino project where I can not use a small NodeMCU.
I've been sitting on it for 2 weeks and have already figured out a few things but I can't get any further.
It would be great if you have some tips for me.
Best regards!