Skip to content

Commit 6ac57ad

Browse files
committed
Fix for ESP8266 Gateway with static IP
According to this: esp8266/Arduino#128 Wifi.config() needs to be called after Wifi.begin(). Otherwise the static IP issn't used by the ESP8266 gateway.
1 parent b5a2fc2 commit 6ac57ad

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

core/MyGatewayTransportEthernet.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,6 @@ bool gatewayTransportInit(void)
123123
#if defined(MY_ESP8266_HOSTNAME)
124124
WiFi.hostname(MY_ESP8266_HOSTNAME);
125125
#endif /* End of MY_ESP8266_HOSTNAME */
126-
#if defined(MY_IP_ADDRESS)
127-
WiFi.config(_ethernetGatewayIP, _gatewayIp, _subnetIp);
128-
#endif /* End of MY_IP_ADDRESS */
129126
#ifndef MY_ESP8266_BSSID
130127
#define MY_ESP8266_BSSID NULL
131128
#endif
@@ -136,6 +133,9 @@ bool gatewayTransportInit(void)
136133
}
137134
GATEWAY_DEBUG(PSTR("GWT:TIN:IP=%s\n"), WiFi.localIP().toString().c_str());
138135
#endif /* End of MY_ESP8266_SSID */
136+
#if defined(MY_IP_ADDRESS)
137+
WiFi.config(_ethernetGatewayIP, _gatewayIp, _subnetIp);
138+
#endif /* End of MY_IP_ADDRESS */
139139
#elif defined(MY_GATEWAY_LINUX) /* Elif part of MY_GATEWAY_ESP8266 */
140140
// Nothing to do here
141141
#else /* Else part of MY_GATEWAY_ESP8266 */

0 commit comments

Comments
 (0)