Hello (sorryI don't know which category it should be posted in),
Did anyone experienced random crashes and core panic' on ESP32 platform using vsnprintf() ? The code below crashes almost always if buffer length is 128 and never when it is 80. Got a number of different exceptions but they are related to stack overrun. Yes I tried to increase stack sizes.
void
xprintf(const char* format, ...) {
va_list args;
va_start(args, format);
char buf[128];
vsnprintf(buf, 128, format, args);
va_end(args);
Serial.print(buf);
}
This code is called from two different tasks, once per minute.
If i comment Serial.print(buf);
out it still crashes. The format strings I supply to it is nothing special and they are all below. Types match formats.
xprintf("CPU : %score, APP is CPU%d, PRO is CPU%d\n", portNUM_PROCESSORS > 1 ? "multi" : "single",app_core, pro_core);
xprintf("Temp : Pin%d=%u, Voltage=%f, Speed=%f, next poll in %d seconds\n",TEMPERATURE_PIN,raw,voltage,sea_temp,TEMPERATURE_INTERVAL);
xprintf("Wind: Pin%d=%u, Voltage=%f, Speed=%f, next poll in %d seconds\n",WINDSPEED_PIN,raw,voltage,speed,WINDSPEED_INTERVAL);
When I change the buffer size to 80 then it all works as expected.