Fix compile problems when enabling UDP

Using 
#define MY_USE_UDP 
Failied building on AVR (only worked on ESP)

Fixes https://github.com/mysensors/Arduino/issues/369
This commit is contained in:
Henrik Ekblad
2016-02-06 17:21:44 +01:00
parent 528e09d5e3
commit d819af40b7
2 changed files with 11 additions and 5 deletions
@@ -264,10 +264,16 @@ bool gatewayTransportAvailable()
if (packet_size) { if (packet_size) {
//debug(PSTR("UDP packet available. Size:%d\n"), packet_size); //debug(PSTR("UDP packet available. Size:%d\n"), packet_size);
_ethernetServer.read(inputString[0].string, MY_GATEWAY_MAX_RECEIVE_LENGTH); #if defined(MY_GATEWAY_ESP8266)
_w5100_spi_en(false); _ethernetServer.read(inputString[0].string, MY_GATEWAY_MAX_RECEIVE_LENGTH);
debug(PSTR("UDP packet received: %s\n"), inputString[0].string); debug(PSTR("UDP packet received: %s\n"), inputString[0].string);
return protocolParse(_ethernetMsg, inputString[0].string); return protocolParse(_ethernetMsg, inputString[0].string);
#else
_ethernetServer.read(inputString.string, MY_GATEWAY_MAX_RECEIVE_LENGTH);
_w5100_spi_en(false);
debug(PSTR("UDP packet received: %s\n"), inputString.string);
return protocolParse(_ethernetMsg, inputString.string);
#endif
} }
#else #else
#if defined(MY_GATEWAY_ESP8266) #if defined(MY_GATEWAY_ESP8266)
@@ -69,7 +69,7 @@
#define MY_RF24_CS_PIN 6 #define MY_RF24_CS_PIN 6
// Enable to UDP // Enable to UDP
//#define MY_USE_UDP #define MY_USE_UDP
#define MY_IP_ADDRESS 192,168,178,66 // If this is disabled, DHCP is used to retrieve address #define MY_IP_ADDRESS 192,168,178,66 // If this is disabled, DHCP is used to retrieve address
// Renewal period if using DHCP // Renewal period if using DHCP