Browse Source

[ESP8266/ESP32] Problem setting hostname while on dynamic ip. (#17)

20 - Device does not change from static IP mode correctly
21 - DHCP hostname is not correctly configured (ESP32 & esp8266)
master
pcniatic 5 years ago
committed by rjwats
parent
commit
2131d86224
  1. 14
      src/WiFiSettingsService.cpp

14
src/WiFiSettingsService.cpp

@ -64,15 +64,17 @@ void WiFiSettingsService::reconfigureWiFiConnection() {
// configure static ip config for station mode (if set)
if (_staticIPConfig) {
WiFi.config(_localIP, _gatewayIP, _subnetMask, _dnsIP1, _dnsIP2);
}
// connect to the network
#if defined(ESP8266)
WiFi.hostname(_hostname);
} else { // else setting dynamic ip config and hostname
#if defined(ESP8266)
WiFi.config(INADDR_ANY, INADDR_ANY, INADDR_ANY);
WiFi.hostname(_hostname);
#elif defined(ESP_PLATFORM)
WiFi.setHostname(_hostname.c_str());
WiFi.config(INADDR_NONE, INADDR_NONE, INADDR_NONE);
WiFi.setHostname(_hostname.c_str());
#endif
}
// connect to the network
WiFi.begin(_ssid.c_str(), _password.c_str());
}

Loading…
Cancel
Save