Fixes ethernet initialisation of static IP settings. Also corrected some debug messages.
This commit is contained in:
@@ -49,13 +49,6 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
|
|||||||
|
|
||||||
//long vid = doc[F("vid")]; // 2010020
|
//long vid = doc[F("vid")]; // 2010020
|
||||||
|
|
||||||
#ifdef WLED_USE_ETHERNET
|
|
||||||
JsonObject ethernet = doc[F("eth")];
|
|
||||||
CJSON(ethernetType, ethernet["type"]);
|
|
||||||
// NOTE: Ethernet configuration takes priority over other use of pins
|
|
||||||
initEthernet();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
JsonObject id = doc["id"];
|
JsonObject id = doc["id"];
|
||||||
getStringFromJson(cmDNS, id[F("mdns")], 33);
|
getStringFromJson(cmDNS, id[F("mdns")], 33);
|
||||||
getStringFromJson(serverDescription, id[F("name")], 33);
|
getStringFromJson(serverDescription, id[F("name")], 33);
|
||||||
@@ -125,6 +118,14 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://github.com/wled/WLED/issues/5247
|
||||||
|
#ifdef WLED_USE_ETHERNET
|
||||||
|
JsonObject ethernet = doc[F("eth")];
|
||||||
|
CJSON(ethernetType, ethernet["type"]);
|
||||||
|
// NOTE: Ethernet configuration takes priority over other use of pins
|
||||||
|
initEthernet();
|
||||||
|
#endif
|
||||||
|
|
||||||
JsonObject ap = doc["ap"];
|
JsonObject ap = doc["ap"];
|
||||||
getStringFromJson(apSSID, ap[F("ssid")], 33);
|
getStringFromJson(apSSID, ap[F("ssid")], 33);
|
||||||
getStringFromJson(apPass, ap["psk"] , 65); //normally not present due to security
|
getStringFromJson(apPass, ap["psk"] , 65); //normally not present due to security
|
||||||
|
|||||||
@@ -239,7 +239,7 @@ bool initEthernet()
|
|||||||
(eth_phy_type_t) es.eth_type,
|
(eth_phy_type_t) es.eth_type,
|
||||||
(eth_clock_mode_t) es.eth_clk_mode
|
(eth_clock_mode_t) es.eth_clk_mode
|
||||||
)) {
|
)) {
|
||||||
DEBUG_PRINTLN(F("initC: ETH.begin() failed"));
|
DEBUG_PRINTLN(F("initE: ETH.begin() failed"));
|
||||||
// de-allocate the allocated pins
|
// de-allocate the allocated pins
|
||||||
for (managed_pin_type mpt : pinsToAllocate) {
|
for (managed_pin_type mpt : pinsToAllocate) {
|
||||||
PinManager::deallocatePin(mpt.pin, PinOwner::Ethernet);
|
PinManager::deallocatePin(mpt.pin, PinOwner::Ethernet);
|
||||||
@@ -247,8 +247,15 @@ bool initEthernet()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://github.com/wled/WLED/issues/5247
|
||||||
|
if (multiWiFi[0].staticIP != (uint32_t)0x00000000 && multiWiFi[0].staticGW != (uint32_t)0x00000000) {
|
||||||
|
ETH.config(multiWiFi[0].staticIP, multiWiFi[0].staticGW, multiWiFi[0].staticSN, dnsAddress);
|
||||||
|
} else {
|
||||||
|
ETH.config(INADDR_NONE, INADDR_NONE, INADDR_NONE);
|
||||||
|
}
|
||||||
|
|
||||||
successfullyConfiguredEthernet = true;
|
successfullyConfiguredEthernet = true;
|
||||||
DEBUG_PRINTLN(F("initC: *** Ethernet successfully configured! ***"));
|
DEBUG_PRINTLN(F("initE: *** Ethernet successfully configured! ***"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -406,11 +413,6 @@ void WiFiEvent(WiFiEvent_t event)
|
|||||||
if (!apActive) {
|
if (!apActive) {
|
||||||
WiFi.disconnect(true); // disable WiFi entirely
|
WiFi.disconnect(true); // disable WiFi entirely
|
||||||
}
|
}
|
||||||
if (multiWiFi[0].staticIP != (uint32_t)0x00000000 && multiWiFi[0].staticGW != (uint32_t)0x00000000) {
|
|
||||||
ETH.config(multiWiFi[0].staticIP, multiWiFi[0].staticGW, multiWiFi[0].staticSN, dnsAddress);
|
|
||||||
} else {
|
|
||||||
ETH.config(INADDR_NONE, INADDR_NONE, INADDR_NONE);
|
|
||||||
}
|
|
||||||
// convert the "serverDescription" into a valid DNS hostname (alphanumeric)
|
// convert the "serverDescription" into a valid DNS hostname (alphanumeric)
|
||||||
char hostname[64];
|
char hostname[64];
|
||||||
prepareHostname(hostname);
|
prepareHostname(hostname);
|
||||||
|
|||||||
Reference in New Issue
Block a user