From 17ea69959e4c05f5fbd1e33ae2837f0ca705df6b Mon Sep 17 00:00:00 2001 From: Guillaume DELVIT Date: Tue, 26 Apr 2016 21:00:07 +0200 Subject: [PATCH] Allow User to manage ESP8266 Wifi if need If MY_ESP8266_SSID is not defined, the WIFI part is managed by the user. If MY_ESP8266_SSID is defined, wifi is managed by Mysensor libraries. --- .../core/MyGatewayTransportEthernet.cpp | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/libraries/MySensors/core/MyGatewayTransportEthernet.cpp b/libraries/MySensors/core/MyGatewayTransportEthernet.cpp index d18fc31..84923da 100644 --- a/libraries/MySensors/core/MyGatewayTransportEthernet.cpp +++ b/libraries/MySensors/core/MyGatewayTransportEthernet.cpp @@ -100,18 +100,20 @@ typedef struct bool gatewayTransportInit() { _w5100_spi_en(true); #if defined(MY_GATEWAY_ESP8266) - (void)WiFi.begin(MY_ESP8266_SSID, MY_ESP8266_PASSWORD); - #ifdef MY_IP_ADDRESS - WiFi.config(_ethernetGatewayIP, gateway, subnet); + #if defined(MY_ESP8266_SSID) + (void)WiFi.begin(MY_ESP8266_SSID, MY_ESP8266_PASSWORD); + #ifdef MY_IP_ADDRESS + WiFi.config(_ethernetGatewayIP, gateway, subnet); + #endif + while (WiFi.status() != WL_CONNECTED) + { + delay(500); + MY_SERIALDEVICE.print("."); + yield(); + } + MY_SERIALDEVICE.print(F("IP: ")); + MY_SERIALDEVICE.println(WiFi.localIP()); #endif - while (WiFi.status() != WL_CONNECTED) - { - delay(500); - MY_SERIALDEVICE.print("."); - yield(); - } - MY_SERIALDEVICE.print(F("IP: ")); - MY_SERIALDEVICE.println(WiFi.localIP()); #else #ifdef MY_IP_ADDRESS