Merge branch 'mdev' of https://github.com/troyhacks/WLED into mdev

This commit is contained in:
Troy
2025-01-29 18:16:59 -05:00
2 changed files with 27 additions and 13 deletions

View File

@@ -161,6 +161,12 @@ int getSignalQuality(int rssi)
return quality; return quality;
} }
#if ESP_IDF_VERSION_MAJOR >= 4
#define SYSTEM_EVENT_ETH_CONNECTED ARDUINO_EVENT_ETH_CONNECTED
#define SYSTEM_EVENT_ETH_DISCONNECTED ARDUINO_EVENT_ETH_DISCONNECTED
#define SYSTEM_EVENT_ETH_START ARDUINO_EVENT_ETH_START
#define SYSTEM_EVENT_ETH_GOT_IP ARDUINO_EVENT_ETH_GOT_IP
#endif
//handle Ethernet connection event //handle Ethernet connection event
void WiFiEvent(WiFiEvent_t event) void WiFiEvent(WiFiEvent_t event)
@@ -170,12 +176,21 @@ void WiFiEvent(WiFiEvent_t event)
case SYSTEM_EVENT_ETH_START: case SYSTEM_EVENT_ETH_START:
DEBUG_PRINTLN(F("ETH Started")); DEBUG_PRINTLN(F("ETH Started"));
break; break;
case SYSTEM_EVENT_ETH_GOT_IP:
if (Network.isEthernet()) {
if (!apActive) {
DEBUG_PRINTLN(F("WiFi Connected *and* ETH Connected. Disabling WIFi"));
WiFi.disconnect(true);
} else {
DEBUG_PRINTLN(F("WiFi Connected *and* ETH Connected. Leaving AP WiFi active"));
}
} else {
DEBUG_PRINTLN(F("WiFi Connected. No ETH"));
}
break;
case SYSTEM_EVENT_ETH_CONNECTED: case SYSTEM_EVENT_ETH_CONNECTED:
{ {
DEBUG_PRINTLN(F("ETH Connected")); DEBUG_PRINTLN(F("ETH Connected"));
if (!apActive) {
WiFi.disconnect(true);
}
if (staticIP != (uint32_t)0x00000000 && staticGateway != (uint32_t)0x00000000) { if (staticIP != (uint32_t)0x00000000 && staticGateway != (uint32_t)0x00000000) {
ETH.config(staticIP, staticGateway, staticSubnet, IPAddress(8, 8, 8, 8)); ETH.config(staticIP, staticGateway, staticSubnet, IPAddress(8, 8, 8, 8));
} else { } else {

View File

@@ -1370,16 +1370,15 @@ void WLED::handleConnection()
} else if (!interfacesInited) { //newly connected } else if (!interfacesInited) { //newly connected
USER_PRINTLN(""); USER_PRINTLN("");
USER_PRINT(F("Connected! IP address: http://")); USER_PRINT(F("Connected! IP address: http://"));
USER_PRINTLN(Network.localIP()); USER_PRINT(Network.localIP());
//if (Network.isEthernet()) { if (Network.isEthernet()) {
// #if ESP32 #if ESP32
// USER_PRINT(ETH.localIP()); USER_PRINTLN(" via Ethernet (disabling WiFi)");
// USER_PRINTLN(" via Ethernet"); WiFi.disconnect(true);
// #endif #endif
//} else { } else {
// USER_PRINT(Network.localIP()); USER_PRINTLN(" via WiFi");
// USER_PRINTLN(" via WiFi"); }
//}
if (improvActive) { if (improvActive) {
if (improvError == 3) sendImprovStateResponse(0x00, true); if (improvError == 3) sendImprovStateResponse(0x00, true);