Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make it possible to use external wifi manager #1537

Open
wants to merge 3 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
9 changes: 7 additions & 2 deletions 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 @@ -219,7 +219,10 @@ bool reconnectMQTT(void)
GATEWAY_DEBUG(PSTR("!GWT:RMQ:FAIL\n"));
#if defined(MY_GATEWAY_ESP8266_SECURE)
char sslErr[256];
int errID = _MQTT_ethClient.getLastSSLError(sslErr, sizeof(sslErr));
#if defined(MY_DEBUG_VERBOSE_GATEWAY)
int errID =
#endif
_MQTT_ethClient.getLastSSLError(sslErr, sizeof(sslErr));
GATEWAY_DEBUG(PSTR("!GWT:RMQ:(%d) %s\n"), errID, sslErr);
#endif
return false;
Expand Down Expand Up @@ -323,8 +326,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
1 change: 1 addition & 0 deletions keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ MY_SLEEP_NOT_POSSIBLE LITERAL1
MY_SPLASH_SCREEN_DISABLED LITERAL1
MY_WAKE_UP_BY_TIMER LITERAL1
MY_SLEEP_HANDLER LITERAL1
MY_EXTERNAL_WIFIMANAGER_USED LITERAL1

# transport
AUTO LITERAL1
Expand Down