From 3ebeb4fea15ee7440bad432f88ef2e8d631e1b14 Mon Sep 17 00:00:00 2001 From: Mikael Falkvidd Date: Fri, 27 Oct 2017 18:52:21 +0200 Subject: [PATCH] Add MY_ESP8266_BSSID parameter (#953) To use this feature, add the following to a sketch, for example GatewayESP8266MQTTClient: const uint8_t bssid[] = {0x00, 0xDE, 0xAD, 0xBE, 0xEF, 0x00}; #define MY_ESP8266_BSSID bssid This feature was requested in https://github.com/mysensors/MySensors/issues/947 --- core/MyGatewayTransportEthernet.cpp | 5 ++++- core/MyGatewayTransportMQTTClient.cpp | 5 ++++- keywords.txt | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/core/MyGatewayTransportEthernet.cpp b/core/MyGatewayTransportEthernet.cpp index 2278c94..fba3305 100644 --- a/core/MyGatewayTransportEthernet.cpp +++ b/core/MyGatewayTransportEthernet.cpp @@ -122,7 +122,10 @@ bool gatewayTransportInit(void) #if defined(MY_IP_ADDRESS) WiFi.config(_ethernetGatewayIP, _gatewayIp, _subnetIp); #endif /* End of MY_IP_ADDRESS */ - (void)WiFi.begin(MY_ESP8266_SSID, MY_ESP8266_PASSWORD); +#ifndef MY_ESP8266_BSSID +#define MY_ESP8266_BSSID NULL +#endif + (void)WiFi.begin(MY_ESP8266_SSID, MY_ESP8266_PASSWORD, 0, MY_ESP8266_BSSID); while (WiFi.status() != WL_CONNECTED) { wait(500); MY_SERIALDEVICE.print(F(".")); diff --git a/core/MyGatewayTransportMQTTClient.cpp b/core/MyGatewayTransportMQTTClient.cpp index 972cd59..f24705a 100644 --- a/core/MyGatewayTransportMQTTClient.cpp +++ b/core/MyGatewayTransportMQTTClient.cpp @@ -154,7 +154,10 @@ bool gatewayTransportInit(void) #if defined(MY_IP_ADDRESS) WiFi.config(_MQTT_clientIp, _gatewayIp, _subnetIp); #endif /* End of MY_IP_ADDRESS */ - (void)WiFi.begin(MY_ESP8266_SSID, MY_ESP8266_PASSWORD); +#ifndef MY_ESP8266_BSSID +#define MY_ESP8266_BSSID NULL +#endif + (void)WiFi.begin(MY_ESP8266_SSID, MY_ESP8266_PASSWORD, 0, MY_ESP8266_BSSID); #endif /* End of MY_GATEWAY_ESP8266 */ gatewayTransportConnect(); diff --git a/keywords.txt b/keywords.txt index 6be07b0..67468c9 100644 --- a/keywords.txt +++ b/keywords.txt @@ -206,5 +206,6 @@ MY_IP_SUBNET_ADDRESS LITERAL1 # ESP8266 MY_ESP8266_SSID LITERAL1 MY_ESP8266_PASSWORD LITERAL1 +MY_ESP8266_BSSID LITERAL1 MY_ESP8266_HOSTNAME LITERAL1 MY_ESP8266_SERIAL_MODE LITERAL1