OK this really got me!
Here is my code I adapted from SPIFFS Time, pre is 0, btw
int timeInit(int pre) {
if (pre == 1) {
//pre-pre init - no wifi yet!
tmstruct.tm_year = 0;
tmstruct.tm_mon = 0;
tmstruct.tm_mday = 0;
tmstruct.tm_hour = 0;
tmstruct.tm_min = 0;
tmstruct.tm_sec = 0;
return -1;
}
Serial.println("Contacting Time Server");
configTime(3600 * timezone, daysavetime * 3600, "time.nist.gov", "0.pool.ntp.org", "1.pool.ntp.org"); <<<<<<<<<<<<< ASSERT FAILS!
sl("After configTime");
delay(2000);
sl("between delay and getlocaltime");
getLocalTime(&tmstruct, 5000);
Serial.printf("\nNow is : %d-%02d-%02d %02d:%02d:%02d\n", (tmstruct.tm_year) + 1900, ( tmstruct.tm_mon) + 1, tmstruct.tm_mday, tmstruct.tm_hour , tmstruct.tm_min, tmstruct.tm_sec);
Serial.println("");
}
freertos/queue.c:1442 (xQueueGenericReceive)- assert failed!
Now, look at original code that runs ok. I just moved the time stuff to it's own fx and globalized the struct tmstruct. It gets past configTime().... it's arguments are the same!
Serial.println("Contacting Time Server");
configTime(3600*timezone, daysavetime*3600, "time.nist.gov", "0.pool.ntp.org", "1.pool.ntp.org");
struct tm tmstruct ;
delay(2000);
tmstruct.tm_year = 0;
getLocalTime(&tmstruct, 5000);
Serial.printf("\nNow is : %d-%02d-%02d %02d:%02d:%02d\n",(tmstruct.tm_year)+1900,( tmstruct.tm_mon)+1, tmstruct.tm_mday,tmstruct.tm_hour , tmstruct.tm_min, tmstruct.tm_sec);
Serial.println("");
I'm giving up.. I tried moving it back into setup like other sketches..
Still at it~! Argh! I read on github issues that for SOME reason calling WiFi.mode(WIFI_STA); before configTime() keeps it from crashing. OK. It didn't crash, but thinks it's 1969...