mirror of
https://github.com/esphome/esphome.git
synced 2024-12-25 15:04:54 +01:00
rollback
This commit is contained in:
parent
662b31eb76
commit
1ac69f0cef
2 changed files with 5 additions and 14 deletions
|
@ -3,7 +3,6 @@
|
|||
#include "esphome/components/network/util.h"
|
||||
#include "udp_component.h"
|
||||
|
||||
#ifdef USE_NETWORK
|
||||
namespace esphome {
|
||||
namespace udp {
|
||||
|
||||
|
@ -262,8 +261,7 @@ void UDPComponent::setup() {
|
|||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef USE_SOCKET_IMPL_LWIP_TCP
|
||||
#else
|
||||
// 8266 and RP2040 `Duino
|
||||
for (const auto &address : this->addresses_) {
|
||||
auto ipaddr = IPAddress();
|
||||
|
@ -372,8 +370,7 @@ void UDPComponent::loop() {
|
|||
for (;;) {
|
||||
#if defined(USE_SOCKET_IMPL_BSD_SOCKETS) || defined(USE_SOCKET_IMPL_LWIP_SOCKETS)
|
||||
auto len = this->listen_socket_->read(buf, sizeof(buf));
|
||||
#endif
|
||||
#ifdef USE_SOCKET_IMPL_LWIP_TCP
|
||||
#else
|
||||
auto len = this->udp_client_.parsePacket();
|
||||
if (len > 0)
|
||||
len = this->udp_client_.read(buf, sizeof(buf));
|
||||
|
@ -590,8 +587,7 @@ void UDPComponent::send_packet_(void *data, size_t len) {
|
|||
if (result < 0)
|
||||
ESP_LOGW(TAG, "sendto() error %d", errno);
|
||||
}
|
||||
#endif
|
||||
#ifdef USE_SOCKET_IMPL_LWIP_TCP
|
||||
#else
|
||||
auto iface = IPAddress(0, 0, 0, 0);
|
||||
for (const auto &saddr : this->ipaddrs_) {
|
||||
if (this->udp_client_.beginPacketMulticast(saddr, this->port_, iface, 128) != 0) {
|
||||
|
@ -618,4 +614,3 @@ void UDPComponent::send_ping_pong_request_() {
|
|||
}
|
||||
} // namespace udp
|
||||
} // namespace esphome
|
||||
#endif
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "esphome/core/component.h"
|
||||
#ifdef USE_NETWORK
|
||||
#ifdef USE_SENSOR
|
||||
#include "esphome/components/sensor/sensor.h"
|
||||
#endif
|
||||
|
@ -10,8 +9,7 @@
|
|||
#endif
|
||||
#if defined(USE_SOCKET_IMPL_BSD_SOCKETS) || defined(USE_SOCKET_IMPL_LWIP_SOCKETS)
|
||||
#include "esphome/components/socket/socket.h"
|
||||
#endif
|
||||
#ifdef USE_SOCKET_IMPL_LWIP_TCP
|
||||
#else
|
||||
#include <WiFiUdp.h>
|
||||
#endif
|
||||
#include <vector>
|
||||
|
@ -127,8 +125,7 @@ class UDPComponent : public PollingComponent {
|
|||
std::unique_ptr<socket::Socket> broadcast_socket_ = nullptr;
|
||||
std::unique_ptr<socket::Socket> listen_socket_ = nullptr;
|
||||
std::vector<struct sockaddr> sockaddrs_{};
|
||||
#endif
|
||||
#ifdef USE_SOCKET_IMPL_LWIP_TCP
|
||||
#else
|
||||
std::vector<IPAddress> ipaddrs_{};
|
||||
WiFiUDP udp_client_{};
|
||||
#endif
|
||||
|
@ -159,4 +156,3 @@ class UDPComponent : public PollingComponent {
|
|||
|
||||
} // namespace udp
|
||||
} // namespace esphome
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue