Skip to content

Commit 50d3c38

Browse files
committed
Merge branch 'esp8266' of https://github.com/jwatte/Arduino into jwatte-esp8266
2 parents ddef215 + 12d53a0 commit 50d3c38

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

hardware/esp8266com/esp8266/libraries/ESP8266WiFi/src/WiFiUdp.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -133,14 +133,13 @@ int WiFiUDP::beginPacket(const char *host, uint16_t port)
133133

134134
int WiFiUDP::beginPacket(IPAddress ip, uint16_t port)
135135
{
136-
ip_addr_t addr;
137-
addr.addr = ip;
138-
139136
if (!_ctx) {
140137
_ctx = new UdpContext;
141138
_ctx->ref();
142139
}
143-
return (_ctx->connect(addr, port)) ? 1 : 0;
140+
begunIp_ = ip;
141+
begunPort_= port;
142+
return 1;
144143
}
145144

146145
int WiFiUDP::beginPacketMulticast(IPAddress multicastAddress, uint16_t port,
@@ -168,8 +167,9 @@ int WiFiUDP::endPacket()
168167
if (!_ctx)
169168
return 0;
170169

171-
_ctx->send();
172-
_ctx->disconnect();
170+
ip_addr_t addr;
171+
addr.addr = begunIp_;
172+
_ctx->send(&addr, begunPort_);
173173
return 1;
174174
}
175175

hardware/esp8266com/esp8266/libraries/ESP8266WiFi/src/WiFiUdp.h

+2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ class UdpContext;
3131
class WiFiUDP : public UDP {
3232
private:
3333
UdpContext* _ctx;
34+
IPAddress begunIp_;
35+
uint16_t begunPort_;
3436

3537
public:
3638
WiFiUDP(); // Constructor

hardware/esp8266com/esp8266/libraries/ESP8266WiFi/src/include/UdpContext.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ class UdpContext
304304

305305
void _reserve(size_t size)
306306
{
307-
const size_t pbuf_unit_size = 1024;
307+
const size_t pbuf_unit_size = 512;
308308
if (!_tx_buf_head)
309309
{
310310
_tx_buf_head = pbuf_alloc(PBUF_TRANSPORT, pbuf_unit_size, PBUF_RAM);

0 commit comments

Comments
 (0)