Skip to content

ARDUINO_EVENT_WIFI_STA_GOT_IP not catched when STA got IP #1833

@maxdd

Description

@maxdd

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions