diff --git a/lib/lib_div/esp-knx-ip-0.5.2/src/esp-knx-ip-send.cpp b/lib/lib_div/esp-knx-ip-0.5.2/src/esp-knx-ip-send.cpp index 92492167a..9a805fb2b 100644 --- a/lib/lib_div/esp-knx-ip-0.5.2/src/esp-knx-ip-send.cpp +++ b/lib/lib_div/esp-knx-ip-0.5.2/src/esp-knx-ip-send.cpp @@ -77,7 +77,14 @@ void ESPKNXIP::send(address_t const &receiver, knx_command_type_t ct, uint8_t da DEBUG_PRINTLN(F("")); #endif +#ifdef ESP8266 udp.beginPacketMulticast(MULTICAST_IP, MULTICAST_PORT, WiFi.localIP()); +#else + if (0 == udp.beginMulticastPacket()) { + udp.beginMulticast(MULTICAST_IP, MULTICAST_PORT); + udp.beginMulticastPacket(); + } +#endif udp.write(buf, len); udp.endPacket(); delay(1); diff --git a/lib/lib_div/esp-knx-ip-0.5.2/src/esp-knx-ip.cpp b/lib/lib_div/esp-knx-ip-0.5.2/src/esp-knx-ip.cpp index 35cbb2161..cc2bbf49a 100644 --- a/lib/lib_div/esp-knx-ip-0.5.2/src/esp-knx-ip.cpp +++ b/lib/lib_div/esp-knx-ip-0.5.2/src/esp-knx-ip.cpp @@ -95,7 +95,11 @@ void ESPKNXIP::__start() #endif server->begin(); } +#ifdef ESP8266 udp.beginMulticast(WiFi.localIP(), MULTICAST_IP, MULTICAST_PORT); +#else + udp.beginMulticast(MULTICAST_IP, MULTICAST_PORT); +#endif } void ESPKNXIP::save_to_eeprom() diff --git a/lib/libesp32/ESP32-to-ESP8266-compat/src/ESP8266WiFi.h b/lib/libesp32/ESP32-to-ESP8266-compat/src/ESP8266WiFi.h index 4a7c3ccc9..97f9c842c 100644 --- a/lib/libesp32/ESP32-to-ESP8266-compat/src/ESP8266WiFi.h +++ b/lib/libesp32/ESP32-to-ESP8266-compat/src/ESP8266WiFi.h @@ -53,37 +53,3 @@ void wifi_station_disconnect(); void wifi_station_dhcpc_start(); extern WiFiClass32 WiFi32; #define WiFi WiFi32 - -class WiFiUDP32 : public WiFiUDP -{ - public: - size_t write(const char*s) - { - return WiFiUDP::write((const uint8_t *)s, strlen(s)); - } - size_t write(const uint8_t *buf, size_t n) - { - return WiFiUDP::write(buf, n); - } - static void stopAll() - { - - } - static void forceSleepWake() - { - - } - uint8_t beginMulticast(IPAddress interfaceAddr, IPAddress multicast, uint16_t port) - { - return WiFiUDP::beginMulticast(multicast, port); - } - void beginPacketMulticast(IPAddress multicast, uint16_t port, IPAddress interfaceAddr) - { - if (0 == WiFiUDP::beginMulticastPacket()) { - WiFiUDP::beginMulticast(multicast, port); - } - WiFiUDP::beginMulticastPacket(); - } -}; - -#define WiFiUDP WiFiUDP32 diff --git a/tasmota/support.ino b/tasmota/support.ino index d28922aa5..0945ea7c7 100644 --- a/tasmota/support.ino +++ b/tasmota/support.ino @@ -2410,7 +2410,7 @@ void SyslogAsync(bool refresh) { line_start += 1460; } #else - PortUdp.write(header); + PortUdp.write((const uint8_t*)header, strlen(header)); PortUdp.write((uint8_t*)line_start, len -mxtime -1); PortUdp.endPacket(); #endif diff --git a/tasmota/support_udp.ino b/tasmota/support_udp.ino index 03ce7c9d1..2e340ceb6 100644 --- a/tasmota/support_udp.ino +++ b/tasmota/support_udp.ino @@ -69,7 +69,9 @@ bool UdpDisconnect(void) PortUdp.stop(); #else // USE_DEVICE_GROUPS // stop all - WiFiUDP::stopAll(); +#ifdef ESP8266 + WiFiUDP::stopAll(); // only for ESP8266 +#endif // ESP8266 #endif // !USE_DEVICE_GROUPS AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_UPNP D_MULTICAST_DISABLED)); udp_connected = false; @@ -92,7 +94,7 @@ bool UdpConnect(void) } #endif // ESP8266 #ifdef ESP32 - if (PortUdp.beginMulticast(WiFi.localIP(), IPAddress(239,255,255,250), 1900)) { + if (PortUdp.beginMulticast(IPAddress(239,255,255,250), 1900)) { AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_UPNP D_MULTICAST_REJOINED)); udp_connected = true; #endif // ESP32 diff --git a/tasmota/xdrv_20_hue.ino b/tasmota/xdrv_20_hue.ino index f86b6d7e6..55d994439 100644 --- a/tasmota/xdrv_20_hue.ino +++ b/tasmota/xdrv_20_hue.ino @@ -205,17 +205,17 @@ void HueRespondToMSearch(void) String uuid = HueUuid(); snprintf_P(response + len, sizeof(response) - len, msg[HUE_RESP_ST1], uuid.c_str()); - PortUdp.write(response); + PortUdp.write((const uint8_t*)response, strlen(response)); PortUdp.endPacket(); // AddLog(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_UPNP "UDP resp=%s"), response); snprintf_P(response + len, sizeof(response) - len, msg[HUE_RESP_ST2], uuid.c_str(), uuid.c_str()); - PortUdp.write(response); + PortUdp.write((const uint8_t*)response, strlen(response)); PortUdp.endPacket(); // AddLog(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_UPNP "UDP resp=%s"), response); snprintf_P(response + len, sizeof(response) - len, msg[HUE_RESP_ST3], uuid.c_str()); - PortUdp.write(response); + PortUdp.write((const uint8_t*)response, strlen(response)); PortUdp.endPacket(); // AddLog(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_UPNP "UDP resp=%s"), response); diff --git a/tasmota/xdrv_21_wemo.ino b/tasmota/xdrv_21_wemo.ino index 926192cc7..f0521aeea4 100644 --- a/tasmota/xdrv_21_wemo.ino +++ b/tasmota/xdrv_21_wemo.ino @@ -67,7 +67,7 @@ void WemoRespondToMSearch(int echo_type) } char response[400]; snprintf_P(response, sizeof(response), WEMO_MSEARCH, WiFi.localIP().toString().c_str(), type, WemoUuid().c_str(), type); - PortUdp.write(response); + PortUdp.write((uint8_t*)response, strlen(response)); PortUdp.endPacket(); snprintf_P(message, sizeof(message), PSTR(D_RESPONSE_SENT)); } else { diff --git a/tasmota/xdrv_21_wemo_multi.ino b/tasmota/xdrv_21_wemo_multi.ino index e2e12c6b3..145e3e8c5 100644 --- a/tasmota/xdrv_21_wemo_multi.ino +++ b/tasmota/xdrv_21_wemo_multi.ino @@ -291,7 +291,7 @@ public: } char response[400]; snprintf_P(response, sizeof(response), WEMO_MSEARCH, WiFi.localIP().toString().c_str(), _localPort, type, WemoUuid().c_str(), type); - PortUdp.write(response); + PortUdp.write((const uint8_t*)response, strlen(response)); PortUdp.endPacket(); // AddLog(LOG_LEVEL_DEBUG, PSTR("WMO: Sending packet device %d: %s"), _deviceId, response);