mirror of
https://github.com/UtilitechAS/amsreader-firmware.git
synced 2026-01-13 15:37:03 +00:00
Fixed hostname for esp32
This commit is contained in:
parent
724768afc4
commit
5cfcc015f4
@ -1,7 +1,7 @@
|
||||
#ifndef _AMSTOMQTTBRIDGE_H
|
||||
#define _AMSTOMQTTBRIDGE_H
|
||||
|
||||
#define WIFI_CONNECTION_TIMEOUT 60000;
|
||||
#define WIFI_CONNECTION_TIMEOUT 30000;
|
||||
|
||||
#define INVALID_BUTTON_PIN 0xFFFFFFFF
|
||||
|
||||
|
||||
@ -1031,6 +1031,11 @@ void WiFi_connect() {
|
||||
|
||||
wifiReconnectCount++;
|
||||
|
||||
#if defined(ESP32)
|
||||
if(strlen(wifi.hostname) > 0) {
|
||||
WiFi.setHostname(wifi.hostname);
|
||||
}
|
||||
#endif
|
||||
WiFi.mode(WIFI_STA);
|
||||
#if defined(ESP32)
|
||||
if(wifi.power >= 195)
|
||||
@ -1082,13 +1087,11 @@ void WiFi_connect() {
|
||||
// WiFi.config(INADDR_NONE, INADDR_NONE, INADDR_NONE); // Workaround to make DHCP hostname work for ESP32. See: https://github.com/espressif/arduino-esp32/issues/2537
|
||||
#endif
|
||||
}
|
||||
if(strlen(wifi.hostname) > 0) {
|
||||
#if defined(ESP8266)
|
||||
WiFi.hostname(wifi.hostname);
|
||||
#elif defined(ESP32)
|
||||
WiFi.setHostname(wifi.hostname);
|
||||
#endif
|
||||
}
|
||||
#if defined(ESP8266)
|
||||
if(strlen(wifi.hostname) > 0) {
|
||||
WiFi.hostname(wifi.hostname);
|
||||
}
|
||||
#endif
|
||||
WiFi.setAutoReconnect(true);
|
||||
WiFi.persistent(true);
|
||||
if(WiFi.begin(wifi.ssid, wifi.psk)) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user