-->
Page 6 of 10

Re: ESP8266WebServer to send larger amounts of data

PostPosted: Mon Aug 31, 2015 3:19 pm
by pipi61
probe this:
http://www.esp8266.com/viewtopic.php?f=29&t=4060

woodwax wrote:Hello

sorry for my newbie question, I would like to use program memory space but the following code doesnt work:

Code: Select all#include <PgmSpace.h>

const char index_html[] PROGMEM = R"=====(
<!DOCTYPE HTML>
<html>
<head><title>ESP8266 Arduino Demo Page</title></head>
<body>ESP8266 power!<p><img src="logo.png"></body>
</html>
)=====";

void setup() {
  Serial.begin(115200);
}

void loop() {
 Serial.println(index_html);
 delay(1000);
}


This is on ESP8266 e12 module with arduino IDE. When I run this code I get wdt error, can anyone correct this code? Thanks

Re: ESP8266WebServer to send larger amounts of data

PostPosted: Mon Aug 31, 2015 8:07 pm
by martinayotte
Unfortunately, Serial.println() doesn't not support PROGMEM directly, and there is no Serial.println_P() method, since maybe there is no big needs for it.
So, you will need to do you own function using memccpy_P() to copy back the PROGMEM string into a local RAM buffer and loop until the end of string.

Re: ESP8266WebServer to send larger amounts of data

PostPosted: Mon Sep 07, 2015 3:53 pm
by GregryCM
martinayotte wrote:... and for those who are on Windows, there is Hexy : https://github.com/tristan2468/Hexy/ ...


I downloaded the WiFi_Progmem.zip file, built and loaded into ESP01 without issue. I then made my own image.png file, used hexy to convert to hex array. The image would only partially load, then cause the EPS8266 to crash. I tried smaller images, simpler images, etc, but all would partially paint, then crash.

The fix was to pad the end of the hex array with enough 0x00's to ensure that the array size was a multiple of 16.

For example:
0xDF,0x64,0x99,0xA6,0xFF,0x07,0x7B,0x88,0x7D,0xF9,0x0D,0x0A,0xC4,0x01,0x00,0x00,
0x00,0x00,0x49,0x45,0x4E,0x44,0xAE,0x42,0x60,0x82};
changes to:
0xDF,0x64,0x99,0xA6,0xFF,0x07,0x7B,0x88,0x7D,0xF9,0x0D,0x0A,0xC4,0x01,0x00,0x00,
0x00,0x00,0x49,0x45,0x4E,0x44,0xAE,0x42,0x60,0x82,0x00,0x00,0x00,0x00,0x00,0x00};

Re: ESP8266WebServer to send larger amounts of data

PostPosted: Mon Sep 07, 2015 5:55 pm
by martinayotte
For ESP crashes, maybe it is related to bug https://github.com/esp8266/Arduino/issues/596.

Are you using ESP8266WebServer ?

I've done some fixes on that yesterday, I've submit a PR to IGRR, waiting for merge.
https://github.com/esp8266/Arduino/pull/753/
(But you can grab the fixes and manually patch your environment)