Using the new Arduino IDE for ESP8266 and found bugs, report them here

Moderator: igrr

User avatar
By OldBikerPete
#51755 I am writing a large-ish sketch to control a watering system, programmable by means of html forms, for the WeMOS D1 mini and suspect that I have used up too much RAM. I am loading a heap of header files:
#include <ESP8266WiFi.h> // WiFi Library
#include <WiFiClient.h> // WiFi Client Library
#include <ESP8266WebServer.h> // Web server Library
#include <ESP8266mDNS.h> // Micro DNS server Library

// On the WeMOS D1 Mini with the micro-SD card shield.
// The SD shield is accessed via the SPI interface
// which uses D5 = SCK
// D6 = MISO
// D7 = MISI
// and D8 = SS
//
#include <SD.h> // Micro-SD card Library

//
// the DS1332/DS1307 RTC uses the I2C bus interface
// which uses D1 = SCL
// and D2 = SDA
//
#include <Wire.h> // Should be loaded by an #include in the following header - does not happen.
#include <DS1307RTC.h> // Real-time clock chip library

#include <MCP2301x.h> // I2C I/O Expander chip library

BTW I wrote the MCP2301x library and will be making it available. It facilitates up to 128 bits of I/O expansion using just the I2C bus and one CPU pin for interrupt support. I would prefer to do some more testing, particularly on the interrupt support, before release though.

I am also using the server library to respond to the html forms.
// Handle GET method
currentServer->on("/", HTTP_GET, [](){ if(!handleFileGET("/")) currentServer->send(404, "text/plain", "FileNotFound"); });

//Handle POST Methods
currentServer->on("/index.htm", HTTP_POST, [](){ if(!handleFileIndex("index.htm")) currentServer->send(404, "text/plain", "FileNotFound"); });
currentServer->on("/choose.htm", HTTP_POST, [](){ if(!handleFileChoose("choose.htm")) currentServer->send(404, "text/plain", "FileNotFound"); });
currentServer->on("/rtclock.htm", HTTP_POST, [](){ if(!handleFileRTClock("rtclock.htm")) currentServer->send(404, "text/plain", "FileNotFound"); });
currentServer->on("/month.htm", HTTP_POST, [](){ if(!handleFileMonth("month.htm")) currentServer->send(404, "text/plain", "FileNotFound"); });
currentServer->on("/week.htm", HTTP_POST, [](){ if(!handleFileWeek("week.htm")) currentServer->send(404, "text/plain", "FileNotFound"); });
currentServer->on("/duration.htm", HTTP_POST, [](){ if(!handleFileDuration("duration.htm")) currentServer->send(404, "text/plain", "FileNotFound"); });
currentServer->on("/durHelp.htm", HTTP_POST, [](){ if(!handleFileDurHelp("durHelp.htm")) currentServer->send(404, "text/plain", "FileNotFound"); });
currentServer->on("/time.htm", HTTP_POST, [](){ if(!handleFileTime("time.htm")) currentServer->send(404, "text/plain", "FileNotFound"); });
currentServer->on("/dirHelp.htm", HTTP_POST, [](){ if(!handleFileDirHelp("dirhelp.htm")) currentServer->send(404, "text/plain", "FileNotFound"); });
currentServer->on("/dirhead.htm", HTTP_POST, [](){ if(!handleFileDirectory("dirhead.htm")) currentServer->send(404, "text/plain", "FileNotFound"); });

//called when the url is not defined here
//TODO: use it to load content from file system
currentServer->onNotFound([](){ handleNotFound(); currentServer->send(404, "text/plain", "FileNotFound"); });

================
The sketch has achieved 1800+ lines plus the libraries, 280kB in debug mode and I'm having weird troubles with the SD library. It is reporting that some files don't exist while others are readily opened and re-opened. Comprehensive checks of the Micro SD card in a couple of card readers confirm that the filesystem is healthy, the files DO exist and can be read.

I'd like to be able to run FreeRam() defined in the SdFatUtils.h library file but when I try I get compile errors saying that the __bss_end and __brkval variables used by that function are undefined.

Any ideas?
Peter.