From 0a106768dafb1927d336067d2fc6b689e1c757df Mon Sep 17 00:00:00 2001 From: lewisxhe Date: Thu, 19 Dec 2024 18:02:43 +0800 Subject: [PATCH] Added IP debug --- examples/Factory/Factory.ino | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/examples/Factory/Factory.ino b/examples/Factory/Factory.ino index 17b27eb..19671c6 100644 --- a/examples/Factory/Factory.ino +++ b/examples/Factory/Factory.ino @@ -468,6 +468,17 @@ void setup() #endif } + WiFi.onEvent([](WiFiEvent_t event, WiFiEventInfo_t info) { + Serial.println("WiFi connected"); + Serial.println("IP address: "); + Serial.println(IPAddress(info.got_ip.ip_info.ip.addr)); + }, WiFiEvent_t::ARDUINO_EVENT_WIFI_STA_GOT_IP); + + WiFiEventId_t eventID = WiFi.onEvent([](WiFiEvent_t event, WiFiEventInfo_t info) { + Serial.print("WiFi lost connection. Reason: "); + Serial.println(info.wifi_sta_disconnected.reason); + }, WiFiEvent_t::ARDUINO_EVENT_WIFI_STA_DISCONNECTED); + setupBoards(true); setupBLE();