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
delay(1);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:
void 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!