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

Moderator: igrr

User avatar
By Leonas
#45682 This weekend I upgraded the IDE from 1.6.7 to 1.6.8 and at the same time upgraded the staging version for the ESP8266 to the stable version. Since then the program on my Adafruit Feather Huzzah ESP crashes when processing data received from the internet. The error is 'ets Jan 8 2013,rst cause:2, boot mode:(1,6)' and 'ets Jan 8 2013,rst cause:4, boot mode:(1,7)'. The ESP does not reboot after that, it just hangs.

The strange thing is that the error does not appear when in debugging mode in Visual Studio / vMicro but it does in release mode. So finding the exact location was a long process. After spending 16 hours I have been able to pinpoint the location and find a solution. The solution, in the end, was adding a simple
Code: Select alldelay(1);

:shock:

Does anyone have an idea what is the real cause of this?
Here is the code part in which I needed to add the delay:
Code: Select allvoid parseWUData(String dataLine) {
  /// Disregard all lines that are not target fields and save the targets in the buffer
  const char* fields[] = {"conditions", "astronomy", "forecast",
                         "full", "observation_time_rfc822", "weather",
                         "temp_c", "relative humidity", "wind_dir","wind_kph",
                         "wind_gust_kph", "pressure_mb", "pressure_trend",
                         "precip_1hr_metric", "precip_today_metric", "title",
                         "fcttext_metric", "percentIlluminated", "ageOfMoon",
                         "phaseofMoon","sunrise", "hour", "minute", "sunset",
                         "moonset", "moonrise"};
  uint8_t numElements = (sizeof(fields) / sizeof(char *));
  for (uint8_t i = 0; i < numElements; i++) {
    if (dataLine.startsWith("\"" + String(fields[i]) + "\"")) {
      delay(1); /// This prevents wdt reset 'ets Jan  8 2013,rst cause:2, boot mode:(1,6)' and 'ets Jan  8 2013,rst cause:4, boot mode:(1,7)'
      tempBuffer[tempBuffCounter] = stripString(dataLine);
      if (tempBuffer[tempBuffCounter].length() == 1 && fields[i] == "hour") {
        tempBuffer[tempBuffCounter] = "0" + tempBuffer[tempBuffCounter];
      }   
      tempBuffCounter++;
    }
  }
}

Dataline is the xml data that I receive from Weather Underground.
Thanks in advance!