Is there anything wrong in doing so:
WiFiManager wm;
if(!wm.autoConnect(HOSTNAME, MDNS_NAME)) {
Serial.println("Failed to connect");
ESP.restart();
}
WiFi.onEvent([](WiFiEvent_t event, WiFiEventInfo_t info) {
Serial.print("[I][ESP32]: WiFi connected. IP: ");
Serial.println(IPAddress(info.got_ip.ip_info.ip.addr));
init_stuff();
},
WiFiEvent_t::ARDUINO_EVENT_WIFI_STA_GOT_IP);
WiFi.onEvent([](WiFiEvent_t event, WiFiEventInfo_t info) {
Serial.print("[I][ESP32]: WiFi lost connection. Reason: ");
Serial.println(info.wifi_sta_disconnected.reason);
ESP.restart();
},
WiFiEvent_t::ARDUINO_EVENT_WIFI_STA_DISCONNECTED);
In my case the ARDUINO_EVENT_WIFI_STA_GOT_IP is never triggered, hence my application never starts (haven't tested ARDUINO_EVENT_WIFI_STA_DISCONNECTED yet)
Is there anything wrong in doing so:
In my case the ARDUINO_EVENT_WIFI_STA_GOT_IP is never triggered, hence my application never starts (haven't tested ARDUINO_EVENT_WIFI_STA_DISCONNECTED yet)