Closed
Description
Hardware:
Board: ESP32 Dev Module
IDE name: Arduino IDE
Flash Frequency: 40Mhz
Upload Speed: 115200
Computer OS: Ubuntu
Description:
When configTime is called without WiFi the code breaks.
Sketch: (leave the backquotes for code formatting)
#include "time.h"
String getLocalTime()
{
String currentTime = "NULL";
struct tm timeStruct;
if (getLocalTime(&timeStruct))
{
currentTime = asctime(&timeStruct);
currentTime.replace("\r", "");
currentTime.replace("\n", "");
}
return currentTime;
}
void setup(){
Serial.begin(115200);
const char *ntpServer = "pool.ntp.org";
const long gmtOffset_sec = 18000 - 1800;
const int daylightOffset_sec = 3600;
configTime(gmtOffset_sec, daylightOffset_sec, ntpServer);
}
void loop(){
Serial.println(getLocalTime());
}
Debug Messages:
/Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/freertos/queue.c:1441 (xQueueGenericReceive)- assert failed!
abort() was called at PC 0x40087879 on core 1
ESP exception decoder
Decoding stack results
0x400850c8: invoke_abort at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/esp32/panic.c line 155
0x400852f5: abort at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/esp32/panic.c line 170
0x40087011: xQueueGenericReceive at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/freertos/queue.c line 1441
0x400f1f52: sys_mutex_lock at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/lwip/port/esp32/freertos/sys_arch.c line 78
0x400f1fd2: sys_arch_protect at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/lwip/port/esp32/freertos/sys_arch.c line 469
0x400e6d74: do_memp_malloc_pool at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/lwip/lwip/src/core/memp.c line 302
0x400e6ddd: memp_malloc at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/lwip/lwip/src/core/memp.c line 398
0x400ecf99: udp_new at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/lwip/lwip/src/core/udp.c line 1145
0x400ecfbe: udp_new_ip_type at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/lwip/lwip/src/core/udp.c line 1177
0x400e5923: sntp_init at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/lwip/lwip/src/apps/sntp/sntp.c line 547
0x400d121b: configTime at /home/acreddy/Desktop/arduino-1.8.5/hardware/espressif/esp32/cores/esp32/esp32-hal-time.c line 55
0x400d1196: setup() at /home/acreddy/Arduino/testtime/testtime.ino line 18
0x400d1b2b: loopTask(void*) at /home/acreddy/Desktop/arduino-1.8.5/hardware/espressif/esp32/cores/esp32/main.cpp line 20
0x400891a9: vPortTaskWrapper at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/freertos/port.c line 143