Allow setting the hostname

Allows setting the hostname if MY_ESP6266_HOSTNAME is defined.
This commit is contained in:
Kirk Davis
2016-05-28 20:36:18 -06:00
parent 4f2f507675
commit f287e4ee95
4 changed files with 14 additions and 0 deletions
@@ -103,6 +103,9 @@ bool gatewayTransportInit() {
#if defined(MY_ESP8266_SSID)
// Turn off access point
WiFi.mode (WIFI_STA);
#if defined(MY_ESP8266_HOSTNAME)
WiFi.hostname(MY_EPS8266_HOSTNAME);
#endif
(void)WiFi.begin(MY_ESP8266_SSID, MY_ESP8266_PASSWORD);
#ifdef MY_IP_ADDRESS
WiFi.config(_ethernetGatewayIP, gateway, subnet);
@@ -167,6 +167,9 @@ bool gatewayTransportInit() {
#if defined(MY_GATEWAY_ESP8266)
// Turn off access point
WiFi.mode (WIFI_STA);
#if defined(MY_ESP8266_HOSTNAME)
WiFi.hostname(MY_ESP8266_HOSTNAME);
#endif
(void)WiFi.begin(MY_ESP8266_SSID, MY_ESP8266_PASSWORD);
#ifdef MY_IP_ADDRESS
WiFi.config(_clientIp, _gatewayIp, _subnetIp);
@@ -86,6 +86,10 @@
// Enable UDP communication
//#define MY_USE_UDP
// Set the hostname for the WiFi Client. This is the hostname
// it will pass to the DHCP server if not static.
// #define MY_ESP8266_HOSTNAME "sensor-gateway"
// Enable MY_IP_ADDRESS here if you want a static ip address (no DHCP)
//#define MY_IP_ADDRESS 192,168,178,87
@@ -88,6 +88,10 @@
#define MY_ESP8266_SSID "MySSID"
#define MY_ESP8266_PASSWORD "MyVerySecretPassword"
// Set the hostname for the WiFi Client. This is the hostname
// it will pass to the DHCP server if not static.
// #define MY_ESP8266_HOSTNAME "mqtt-sensor-gateway"
// Enable MY_IP_ADDRESS here if you want a static ip address (no DHCP)
#define MY_IP_ADDRESS 192,168,178,87