Skip to content

Commit d819af4

Browse files
committed
Fix compile problems when enabling UDP
Using #define MY_USE_UDP Failied building on AVR (only worked on ESP) Fixes mysensors/MySensors#369
1 parent 528e09d commit d819af4

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

libraries/MySensors/core/MyGatewayTransportEthernet.cpp

+10-4
Original file line numberDiff line numberDiff line change
@@ -264,10 +264,16 @@ bool gatewayTransportAvailable()
264264

265265
if (packet_size) {
266266
//debug(PSTR("UDP packet available. Size:%d\n"), packet_size);
267-
_ethernetServer.read(inputString[0].string, MY_GATEWAY_MAX_RECEIVE_LENGTH);
268-
_w5100_spi_en(false);
269-
debug(PSTR("UDP packet received: %s\n"), inputString[0].string);
270-
return protocolParse(_ethernetMsg, inputString[0].string);
267+
#if defined(MY_GATEWAY_ESP8266)
268+
_ethernetServer.read(inputString[0].string, MY_GATEWAY_MAX_RECEIVE_LENGTH);
269+
debug(PSTR("UDP packet received: %s\n"), inputString[0].string);
270+
return protocolParse(_ethernetMsg, inputString[0].string);
271+
#else
272+
_ethernetServer.read(inputString.string, MY_GATEWAY_MAX_RECEIVE_LENGTH);
273+
_w5100_spi_en(false);
274+
debug(PSTR("UDP packet received: %s\n"), inputString.string);
275+
return protocolParse(_ethernetMsg, inputString.string);
276+
#endif
271277
}
272278
#else
273279
#if defined(MY_GATEWAY_ESP8266)

libraries/MySensors/examples/GatewayW5100/GatewayW5100.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
#define MY_RF24_CS_PIN 6
7070

7171
// Enable to UDP
72-
//#define MY_USE_UDP
72+
#define MY_USE_UDP
7373

7474
#define MY_IP_ADDRESS 192,168,178,66 // If this is disabled, DHCP is used to retrieve address
7575
// Renewal period if using DHCP

0 commit comments

Comments
 (0)