Example sketches for the new Arduino IDE for ESP8266

Moderator: igrr

User avatar
By curlywurly
#24291 OK had a quick trawl and apart from the "application" code added by Ridge, the following seems to be the extent of the changes to the original code (as at 26/7/15). For the time, being, I think we will have to manually apply the following fixes for now (and maybe others I've missed?)

Irrigation_3 compared to ESP_WebConfig_Master
Original (Proteus74)
server.on ( "/admin.html", []() { Serial.println("admin.html"); server.send ( 200, "text/html", PAGE_AdminMainPage ); } );
server.on ( "/config.html", send_network_configuration_html );
server.on ( "/info.html", []() { Serial.println("info.html"); server.send ( 200, "text/html", PAGE_Information ); } );
server.on ( "/ntp.html", send_NTP_configuration_html );
server.on ( "/general.html", send_general_html );
// server.on ( "/example.html", []() { server.send ( 200, "text/html", PAGE_EXAMPLE ); } );
server.on ( "/style.css", []() { Serial.println("style.css"); server.send ( 200, "text/plain", PAGE_Style_css ); } );
server.on ( "/microajax.js", []() { Serial.println("microajax.js"); server.send ( 200, "text/plain", PAGE_microajax_js ); } );
Changed To (Ridge)
server.on ( "/admin.html", []() { Serial.println("admin.html"); server.send ( 200, "text/html", reinterpret_cast<const __FlashStringHelper *>(PAGE_AdminMainPage )); } );
server.on ( "/config.html", send_network_configuration_html );
server.on ( "/info.html", []() { Serial.println("info.html"); server.send ( 200, "text/html", reinterpret_cast<const __FlashStringHelper *>(PAGE_Information )); } );
server.on ( "/ntp.html", send_NTP_configuration_html );
server.on ( "/general.html", send_general_html );
// server.on ( "/example.html", []() { server.send ( 200, "text/html", PAGE_EXAMPLE ); } );
server.on ( "/style.css", []() { Serial.println("style.css"); server.send ( 200, "text/plain", reinterpret_cast<const __FlashStringHelper *>(PAGE_Style_css )); } );
server.on ( "/microajax.js", []() { Serial.println("microajax.js"); server.send ( 200, "text/plain", reinterpret_cast<const __FlashStringHelper *>(PAGE_microajax_js )); } );

PAGE_NetworkConfiguration.h
Original (Proteus74)
server.send ( 200, "text/html", PAGE_WaitAndReload );
Changed To (Ridge)
server.send ( 200, "text/html", reinterpret_cast<const __FlashStringHelper *>(PAGE_WaitAndReload ));


Page_Root.H
Original (Proteus74)
server.send ( 200, "text/html", PAGE_Root );
Changed To (Ridge)
server.send ( 200, "text/html", reinterpret_cast<const __FlashStringHelper *>(PAGE_Root) );

example.h
Original (Proteus74)
server.send ( 200, "text/html", PAGE_example );
Changed To (Ridge)
server.send ( 200, "text/html", reinterpret_cast<const __FlashStringHelper *>(PAGE_example));
User avatar
By danbicks
#24298 Hi Ridge and curlywurly,

Firstly Ridge massive thanks really like the changes you have made and see how you have modified the original code to your requirement. Looking through the threads the issue seem'd to be with Progmem, with the changes I have used Ridges example and basically commented out all of the I/O pins as I am using some ESP01 types. I still find it causes a WDT crash / reset when web pages are selected through the admin menu, this I want to avoid before I build on this functionality and add MQTT library support etc.

From what I have read the following: reinterpret_cast<const __FlashStringHelper *>(PAGE_Root) simply tells the processor where in flash the page code is located, this does not on an ESP01 seem to cure the WDT issue. I will try on an ESP12 and see how it performs on this type.

Guys massive thanks, this is a brilliant thread, by far the best web interface for use with the Arduino IDE platform.

Does anyone know what other features microajax provides?

Dans
User avatar
By curlywurly
#24306
danbicks wrote:Hi Ridge and curlywurly,
... I still find it causes a WDT crash / reset when web pages are selected through the admin menu, this I want to avoid before I build on this functionality and add MQTT library support etc.
....From what I have read the following: reinterpret_cast<const __FlashStringHelper *>(PAGE_Root) simply tells the processor where in flash the page code is located, this does not on an ESP01 seem to cure the WDT issue. I will try on an ESP12 and see how it performs on this type.
Dans

Hi Dan,
Have a look at the post by folny82 on page 4 of this thread. Does it help you?
Folny82 attached his version of the code which he believes addresses the WDT issue.
*Edit having looked at it again - maybe the WDT is not solved yet in anyone's version? :(
N.B. Folny82's version of Proteus74's original is here http://www.esp8266.com/download/file.php?id=1296.
I've noticed that Folny82 has added this line to his version of ESP_WebConfig_master.ino
server.on ( "/fwupdate.html", []() { server.send ( 200, "text/html", PAGE_FwUpdate ); } );

Maybe a combination of all 3 versions is needed.
Proteus74 did menition that he will update the code accordingly, but I don't think this has happened yet.
User avatar
By folny82
#24309
curlywurly wrote:
danbicks wrote:Hi Ridge and curlywurly,
... I still find it causes a WDT crash / reset when web pages are selected through the admin menu, this I want to avoid before I build on this functionality and add MQTT library support etc.
....From what I have read the following: reinterpret_cast<const __FlashStringHelper *>(PAGE_Root) simply tells the processor where in flash the page code is located, this does not on an ESP01 seem to cure the WDT issue. I will try on an ESP12 and see how it performs on this type.
Dans

Hi Dan,
Have a look at the post by folny82 on page 4 of this thread. Does it help you?
Folny82 attached his version of the code which he believes addresses the WDT issue.
*Edit having looked at it again - maybe the WDT is not solved yet in anyone's version? :(
N.B. Folny82's version of Proteus74's original is here http://www.esp8266.com/download/file.php?id=1296.
I've noticed that Folny82 has added this line to his version of ESP_WebConfig_master.ino
server.on ( "/fwupdate.html", []() { server.send ( 200, "text/html", PAGE_FwUpdate ); } );

Maybe a combination of all 3 versions is needed.
Proteus74 did menition that he will update the code accordingly, but I don't think this has happened yet.


To support the Fw Update via web interface you must update the latest library ESP8266 Arduino via the board manager.

https://github.com/esp8266/Arduino
http://arduino.esp8266.com/stable/packa ... index.json