Remove WiFiUDP32 to solve linker warnings

This commit is contained in:
Stephan Hadinger 2022-01-14 22:53:19 +01:00
parent 7596a8edde
commit fffcf1c2df
8 changed files with 21 additions and 42 deletions

View File

@ -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);

View File

@ -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()

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -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 {

View File

@ -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);