Avoid redundant localIP calls, each call takes 0.700 us on ESP32 240Mhz (#2206)

* Avoid redundant localIP calls, each call takes 0.700 us on ESP32 240Mhz

* Fall through to check Wifi local ip if not connected to ETH

* Changed local var from ipAddress to localIP to better reflect content
This commit is contained in:
Phil Bolduc
2021-09-19 10:51:54 -07:00
committed by GitHub
parent b8e8028eb9
commit 3577da05ac
3 changed files with 17 additions and 9 deletions

View File

@@ -591,13 +591,14 @@ void WLED::initConnection()
void WLED::initInterfaces()
{
IPAddress ipAddress = Network.localIP();
DEBUG_PRINTLN(F("Init STA interfaces"));
#ifndef WLED_DISABLE_HUESYNC
if (hueIP[0] == 0) {
hueIP[0] = Network.localIP()[0];
hueIP[1] = Network.localIP()[1];
hueIP[2] = Network.localIP()[2];
hueIP[0] = ipAddress[0];
hueIP[1] = ipAddress[1];
hueIP[2] = ipAddress[2];
}
#endif