Skip to content

Commit

Permalink
Make it possible to use external wifi manager
Browse files Browse the repository at this point in the history
by defining MY_EXTERNAL_WIFIMANAGER_USED
  • Loading branch information
magwas committed Jan 1, 2023
1 parent 093afa0 commit dc2b6ba
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion core/MyGatewayTransportEthernet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ extern MyMessage _msgTmp;
#endif

#if defined(MY_GATEWAY_ESP8266) || defined(MY_GATEWAY_ESP32)
#if !defined(MY_WIFI_SSID)
#if !defined(MY_WIFI_SSID) && !defined(MY_EXTERNAL_WIFIMANAGER_USED)
#error ESP8266/ESP32 gateway: MY_WIFI_SSID not defined!
#endif
#endif
Expand Down Expand Up @@ -171,12 +171,14 @@ bool gatewayTransportInit(void)
#ifdef MY_IP_ADDRESS
WiFi.config(_ethernetGatewayIP, _gatewayIp, _subnetIp);
#endif
#if !defined(MY_EXTERNAL_WIFIMANAGER_USED)
(void)WiFi.begin(MY_WIFI_SSID, MY_WIFI_PASSWORD, 0, MY_WIFI_BSSID);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
GATEWAY_DEBUG(PSTR("GWT:TIN:CONNECTING...\n"));
}
GATEWAY_DEBUG(PSTR("GWT:TIN:IP: %s\n"), WiFi.localIP().toString().c_str());
#endif
#elif defined(MY_GATEWAY_LINUX)
// Nothing to do here
#else
Expand Down
4 changes: 3 additions & 1 deletion core/MyGatewayTransportMQTTClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
#endif

#if defined(MY_GATEWAY_ESP8266) || defined(MY_GATEWAY_ESP8266_SECURE) || defined(MY_GATEWAY_ESP32)
#if !defined(MY_WIFI_SSID)
#if !defined(MY_WIFI_SSID) && !defined(MY_EXTERNAL_WIFIMANAGER_USED)
#error ESP8266/ESP32 MQTT gateway: MY_WIFI_SSID not defined!
#endif
#endif
Expand Down Expand Up @@ -323,8 +323,10 @@ bool gatewayTransportInit(void)
#if defined(MY_IP_ADDRESS)
WiFi.config(_MQTT_clientIp, _gatewayIp, _subnetIp);
#endif /* End of MY_IP_ADDRESS */
#if !defined(MY_EXTERNAL_WIFIMANAGER_USED)
(void)WiFi.begin(MY_WIFI_SSID, MY_WIFI_PASSWORD, 0, MY_WIFI_BSSID);
#endif
#endif

#if defined(MY_GATEWAY_ESP8266_SECURE)
// Certificate Authorities are stored in the X509 list
Expand Down

0 comments on commit dc2b6ba

Please sign in to comment.