Skip to content

Commit 90f1249

Browse files
committed
Force reconnect on Ethernet returning
1 parent e123c48 commit 90f1249

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

wled00/network.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -352,11 +352,15 @@ void WiFiEvent(WiFiEvent_t event)
352352
DEBUG_PRINTLN(F("ETH Started"));
353353
break;
354354
case SYSTEM_EVENT_ETH_GOT_IP:
355-
DEBUG_PRINTLN(F("ETH Got IP"));
356-
// Disconnect WiFi here in event context (original behavior that worked)
357-
if (!apActive && WiFi.status() == WL_CONNECTED) {
358-
DEBUG_PRINTLN(F("Disabling WiFi from event handler"));
359-
WiFi.disconnect(true);
355+
if (Network.isEthernet()) {
356+
if (!apActive) {
357+
DEBUG_PRINTLN(F("WiFi Connected *and* ETH Connected. Disabling WIFi"));
358+
WiFi.disconnect(true);
359+
} else {
360+
DEBUG_PRINTLN(F("WiFi Connected *and* ETH Connected. Leaving AP WiFi active"));
361+
}
362+
} else {
363+
DEBUG_PRINTLN(F("WiFi Connected. No ETH"));
360364
}
361365
forceReconnect = true;
362366
break;

0 commit comments

Comments
 (0)