Skip to content

Commit 5c8234f

Browse files
committed
Merge pull request arduino#424 from guiguid/patch-1
Allow User to manage ESP8266 Wifi if need
2 parents d65e73a + 17ea699 commit 5c8234f

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

libraries/MySensors/core/MyGatewayTransportEthernet.cpp

+13-11
Original file line numberDiff line numberDiff line change
@@ -100,18 +100,20 @@ typedef struct
100100
bool gatewayTransportInit() {
101101
_w5100_spi_en(true);
102102
#if defined(MY_GATEWAY_ESP8266)
103-
(void)WiFi.begin(MY_ESP8266_SSID, MY_ESP8266_PASSWORD);
104-
#ifdef MY_IP_ADDRESS
105-
WiFi.config(_ethernetGatewayIP, gateway, subnet);
103+
#if defined(MY_ESP8266_SSID)
104+
(void)WiFi.begin(MY_ESP8266_SSID, MY_ESP8266_PASSWORD);
105+
#ifdef MY_IP_ADDRESS
106+
WiFi.config(_ethernetGatewayIP, gateway, subnet);
107+
#endif
108+
while (WiFi.status() != WL_CONNECTED)
109+
{
110+
delay(500);
111+
MY_SERIALDEVICE.print(".");
112+
yield();
113+
}
114+
MY_SERIALDEVICE.print(F("IP: "));
115+
MY_SERIALDEVICE.println(WiFi.localIP());
106116
#endif
107-
while (WiFi.status() != WL_CONNECTED)
108-
{
109-
delay(500);
110-
MY_SERIALDEVICE.print(".");
111-
yield();
112-
}
113-
MY_SERIALDEVICE.print(F("IP: "));
114-
MY_SERIALDEVICE.println(WiFi.localIP());
115117

116118
#else
117119
#ifdef MY_IP_ADDRESS

0 commit comments

Comments
 (0)