kopia lustrzana https://github.com/Aircoookie/WLED
Rename Network to WLEDNetwork to prevent clash
rodzic
ba2b182bb3
commit
07ab6aa3ea
|
@ -358,7 +358,7 @@ void WiFiEvent(WiFiEvent_t event)
|
||||||
DEBUG_PRINTF_P(PSTR("WiFi-E: AP Client Connected (%d) @ %lus.\n"), (int)apClients, millis()/1000);
|
DEBUG_PRINTF_P(PSTR("WiFi-E: AP Client Connected (%d) @ %lus.\n"), (int)apClients, millis()/1000);
|
||||||
break;
|
break;
|
||||||
case ARDUINO_EVENT_WIFI_STA_GOT_IP:
|
case ARDUINO_EVENT_WIFI_STA_GOT_IP:
|
||||||
DEBUG_PRINT(F("WiFi-E: IP address: ")); DEBUG_PRINTLN(Network.localIP());
|
DEBUG_PRINT(F("WiFi-E: IP address: ")); DEBUG_PRINTLN(WLEDNetwork.localIP());
|
||||||
break;
|
break;
|
||||||
case ARDUINO_EVENT_WIFI_STA_CONNECTED:
|
case ARDUINO_EVENT_WIFI_STA_CONNECTED:
|
||||||
// followed by IDLE and SCAN_DONE
|
// followed by IDLE and SCAN_DONE
|
||||||
|
|
|
@ -76,7 +76,7 @@ bool ESPAsyncE131::initMulticast(uint16_t port, uint16_t universe, uint8_t n) {
|
||||||
ip4_addr_t ifaddr;
|
ip4_addr_t ifaddr;
|
||||||
ip4_addr_t multicast_addr;
|
ip4_addr_t multicast_addr;
|
||||||
|
|
||||||
ifaddr.addr = static_cast<uint32_t>(Network.localIP());
|
ifaddr.addr = static_cast<uint32_t>(WLEDNetwork.localIP());
|
||||||
for (uint8_t i = 1; i < n; i++) {
|
for (uint8_t i = 1; i < n; i++) {
|
||||||
multicast_addr.addr = static_cast<uint32_t>(IPAddress(239, 255,
|
multicast_addr.addr = static_cast<uint32_t>(IPAddress(239, 255,
|
||||||
(((universe + i) >> 8) & 0xff), (((universe + i) >> 0)
|
(((universe + i) >> 8) & 0xff), (((universe + i) >> 0)
|
||||||
|
|
|
@ -344,7 +344,7 @@ public:
|
||||||
#ifdef ARDUINO_ARCH_ESP32
|
#ifdef ARDUINO_ARCH_ESP32
|
||||||
udpConnected = espalexaUdp.beginMulticast(IPAddress(239, 255, 255, 250), 1900);
|
udpConnected = espalexaUdp.beginMulticast(IPAddress(239, 255, 255, 250), 1900);
|
||||||
#else
|
#else
|
||||||
udpConnected = espalexaUdp.beginMulticast(Network.localIP(), IPAddress(239, 255, 255, 250), 1900);
|
udpConnected = espalexaUdp.beginMulticast(WLEDNetwork.localIP(), IPAddress(239, 255, 255, 250), 1900);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (udpConnected){
|
if (udpConnected){
|
||||||
|
|
|
@ -196,7 +196,7 @@ void notify(byte callMode, bool followUp)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
DEBUG_PRINTLN(F("UDP sending packet."));
|
DEBUG_PRINTLN(F("UDP sending packet."));
|
||||||
IPAddress broadcastIp = ~uint32_t(Network.subnetMask()) | uint32_t(Network.gatewayIP());
|
IPAddress broadcastIp = ~uint32_t(WLEDNetwork.subnetMask()) | uint32_t(WLEDNetwork.gatewayIP());
|
||||||
notifierUdp.beginPacket(broadcastIp, udpPort);
|
notifierUdp.beginPacket(broadcastIp, udpPort);
|
||||||
notifierUdp.write(udpOut, WLEDPACKETSIZE); // TODO: add actual used buffer size
|
notifierUdp.write(udpOut, WLEDPACKETSIZE); // TODO: add actual used buffer size
|
||||||
notifierUdp.endPacket();
|
notifierUdp.endPacket();
|
||||||
|
@ -516,7 +516,7 @@ void handleNotifications()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
localIP = Network.localIP();
|
localIP = WLEDNetwork.localIP();
|
||||||
//notifier and UDP realtime
|
//notifier and UDP realtime
|
||||||
if (!packetSize || packetSize > UDP_IN_MAXSIZE) return;
|
if (!packetSize || packetSize > UDP_IN_MAXSIZE) return;
|
||||||
if (!isSupp && notifierUdp.remoteIP() == localIP) return; //don't process broadcasts we send ourselves
|
if (!isSupp && notifierUdp.remoteIP() == localIP) return; //don't process broadcasts we send ourselves
|
||||||
|
@ -707,7 +707,7 @@ void sendSysInfoUDP()
|
||||||
{
|
{
|
||||||
if (!udp2Connected) return;
|
if (!udp2Connected) return;
|
||||||
|
|
||||||
IPAddress ip = Network.localIP();
|
IPAddress ip = WLEDNetwork.localIP();
|
||||||
if (!ip || ip == IPAddress(255,255,255,255)) ip = IPAddress(4,3,2,1);
|
if (!ip || ip == IPAddress(255,255,255,255)) ip = IPAddress(4,3,2,1);
|
||||||
|
|
||||||
// TODO: make a nice struct of it and clean up
|
// TODO: make a nice struct of it and clean up
|
||||||
|
|
|
@ -109,7 +109,7 @@ void WLED::loop()
|
||||||
{
|
{
|
||||||
if (apActive) dnsServer.processNextRequest();
|
if (apActive) dnsServer.processNextRequest();
|
||||||
#ifdef WLED_ENABLE_AOTA
|
#ifdef WLED_ENABLE_AOTA
|
||||||
if (Network.isConnected() && aOtaEnabled && !otaLock && correctPIN) ArduinoOTA.handle();
|
if (WLEDNetwork.isConnected() && aOtaEnabled && !otaLock && correctPIN) ArduinoOTA.handle();
|
||||||
#endif
|
#endif
|
||||||
handleNightlight();
|
handleNightlight();
|
||||||
yield();
|
yield();
|
||||||
|
@ -262,7 +262,7 @@ void WLED::loop()
|
||||||
lastWifiState = WiFi.status();
|
lastWifiState = WiFi.status();
|
||||||
DEBUG_PRINTF_P(PSTR("State time: %lu\n"), wifiStateChangedTime);
|
DEBUG_PRINTF_P(PSTR("State time: %lu\n"), wifiStateChangedTime);
|
||||||
DEBUG_PRINTF_P(PSTR("NTP last sync: %lu\n"), ntpLastSyncTime);
|
DEBUG_PRINTF_P(PSTR("NTP last sync: %lu\n"), ntpLastSyncTime);
|
||||||
DEBUG_PRINTF_P(PSTR("Client IP: %u.%u.%u.%u\n"), Network.localIP()[0], Network.localIP()[1], Network.localIP()[2], Network.localIP()[3]);
|
DEBUG_PRINTF_P(PSTR("Client IP: %u.%u.%u.%u\n"), WLEDNetwork.localIP()[0], WLEDNetwork.localIP()[1], WLEDNetwork.localIP()[2], WLEDNetwork.localIP()[3]);
|
||||||
if (loops > 0) { // avoid division by zero
|
if (loops > 0) { // avoid division by zero
|
||||||
DEBUG_PRINTF_P(PSTR("Loops/sec: %u\n"), loops / 30);
|
DEBUG_PRINTF_P(PSTR("Loops/sec: %u\n"), loops / 30);
|
||||||
DEBUG_PRINTF_P(PSTR("Loop time[ms]: %u/%lu\n"), avgLoopMillis/loops, maxLoopMillis);
|
DEBUG_PRINTF_P(PSTR("Loop time[ms]: %u/%lu\n"), avgLoopMillis/loops, maxLoopMillis);
|
||||||
|
@ -700,7 +700,7 @@ void WLED::initInterfaces()
|
||||||
DEBUG_PRINTLN(F("Init STA interfaces"));
|
DEBUG_PRINTLN(F("Init STA interfaces"));
|
||||||
|
|
||||||
#ifndef WLED_DISABLE_HUESYNC
|
#ifndef WLED_DISABLE_HUESYNC
|
||||||
IPAddress ipAddress = Network.localIP();
|
IPAddress ipAddress = WLEDNetwork.localIP();
|
||||||
if (hueIP[0] == 0) {
|
if (hueIP[0] == 0) {
|
||||||
hueIP[0] = ipAddress[0];
|
hueIP[0] = ipAddress[0];
|
||||||
hueIP[1] = ipAddress[1];
|
hueIP[1] = ipAddress[1];
|
||||||
|
@ -786,7 +786,7 @@ void WLED::handleConnection()
|
||||||
if (stac != stacO) {
|
if (stac != stacO) {
|
||||||
stacO = stac;
|
stacO = stac;
|
||||||
DEBUG_PRINTF_P(PSTR("Connected AP clients: %d\n"), (int)stac);
|
DEBUG_PRINTF_P(PSTR("Connected AP clients: %d\n"), (int)stac);
|
||||||
if (!Network.isConnected() && wifiConfigured) { // trying to connect, but not connected
|
if (!WLEDNetwork.isConnected() && wifiConfigured) { // trying to connect, but not connected
|
||||||
if (stac)
|
if (stac)
|
||||||
WiFi.disconnect(); // disable search so that AP can work
|
WiFi.disconnect(); // disable search so that AP can work
|
||||||
else
|
else
|
||||||
|
@ -795,7 +795,7 @@ void WLED::handleConnection()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Network.isConnected()) {
|
if (!WLEDNetwork.isConnected()) {
|
||||||
if (interfacesInited) {
|
if (interfacesInited) {
|
||||||
if (scanDone && multiWiFi.size() > 1) {
|
if (scanDone && multiWiFi.size() > 1) {
|
||||||
DEBUG_PRINTLN(F("WiFi scan initiated on disconnect."));
|
DEBUG_PRINTLN(F("WiFi scan initiated on disconnect."));
|
||||||
|
@ -839,7 +839,7 @@ void WLED::handleConnection()
|
||||||
} else if (!interfacesInited) { //newly connected
|
} else if (!interfacesInited) { //newly connected
|
||||||
DEBUG_PRINTLN();
|
DEBUG_PRINTLN();
|
||||||
DEBUG_PRINT(F("Connected! IP address: "));
|
DEBUG_PRINT(F("Connected! IP address: "));
|
||||||
DEBUG_PRINTLN(Network.localIP());
|
DEBUG_PRINTLN(WLEDNetwork.localIP());
|
||||||
if (improvActive) {
|
if (improvActive) {
|
||||||
if (improvError == 3) sendImprovStateResponse(0x00, true);
|
if (improvError == 3) sendImprovStateResponse(0x00, true);
|
||||||
sendImprovStateResponse(0x04);
|
sendImprovStateResponse(0x04);
|
||||||
|
@ -861,7 +861,7 @@ void WLED::handleConnection()
|
||||||
}
|
}
|
||||||
|
|
||||||
// If status LED pin is allocated for other uses, does nothing
|
// If status LED pin is allocated for other uses, does nothing
|
||||||
// else blink at 1Hz when Network.isConnected() is false (no WiFi, ?? no Ethernet ??)
|
// else blink at 1Hz when WLEDNetwork.isConnected() is false (no WiFi, ?? no Ethernet ??)
|
||||||
// else blink at 2Hz when MQTT is enabled but not connected
|
// else blink at 2Hz when MQTT is enabled but not connected
|
||||||
// else turn the status LED off
|
// else turn the status LED off
|
||||||
#if defined(STATUSLED)
|
#if defined(STATUSLED)
|
||||||
|
@ -875,7 +875,7 @@ void WLED::handleStatusLED()
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (Network.isConnected()) {
|
if (WLEDNetwork.isConnected()) {
|
||||||
c = RGBW32(0,255,0,0);
|
c = RGBW32(0,255,0,0);
|
||||||
ledStatusType = 2;
|
ledStatusType = 2;
|
||||||
} else if (WLED_MQTT_CONNECTED) {
|
} else if (WLED_MQTT_CONNECTED) {
|
||||||
|
|
|
@ -44,7 +44,7 @@ static bool inSubnet(const IPAddress &ip, const IPAddress &subnet, const IPAddre
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool inSameSubnet(const IPAddress &client) {
|
static bool inSameSubnet(const IPAddress &client) {
|
||||||
return inSubnet(client, Network.localIP(), Network.subnetMask());
|
return inSubnet(client, WLEDNetwork.localIP(), WLEDNetwork.subnetMask());
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool inLocalSubnet(const IPAddress &client) {
|
static bool inLocalSubnet(const IPAddress &client) {
|
||||||
|
|
|
@ -233,10 +233,10 @@ void getSettingsJS(byte subPage, Print& settingsScript)
|
||||||
settingsScript.print(F("gId('ethd').style.display='none';"));
|
settingsScript.print(F("gId('ethd').style.display='none';"));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (Network.isConnected()) //is connected
|
if (WLEDNetwork.isConnected()) //is connected
|
||||||
{
|
{
|
||||||
char s[32];
|
char s[32];
|
||||||
IPAddress localIP = Network.localIP();
|
IPAddress localIP = WLEDNetwork.localIP();
|
||||||
sprintf(s, "%d.%d.%d.%d", localIP[0], localIP[1], localIP[2], localIP[3]);
|
sprintf(s, "%d.%d.%d.%d", localIP[0], localIP[1], localIP[2], localIP[3]);
|
||||||
|
|
||||||
#if defined(ARDUINO_ARCH_ESP32) && defined(WLED_USE_ETHERNET)
|
#if defined(ARDUINO_ARCH_ESP32) && defined(WLED_USE_ETHERNET)
|
||||||
|
|
Ładowanie…
Reference in New Issue