From 0629f54d0fd034f7c6c60734f7dee6e0acb189f9 Mon Sep 17 00:00:00 2001 From: Pim Date: Wed, 17 Jul 2024 23:20:27 +0200 Subject: [PATCH] fix: set hostname before mode See https://github.com/espressif/arduino-esp32/issues/6278, setHostname needs to be called before setting the wifi mode cause otherwise it will not / not always be set correctly --- src/network.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/network.cpp b/src/network.cpp index c1a78e5..b39e39e 100644 --- a/src/network.cpp +++ b/src/network.cpp @@ -54,11 +54,11 @@ void keepWiFiAlive(void *parameter) } Serial.println("[WIFI] Connecting..."); + WiFi.setHostname(HOSTNAME); // only works with DHCP.... WiFi.mode(WIFI_STA); #ifdef STATIC_IP WiFi.config(ip, gateway, subnet, dns); #endif - WiFi.setHostname(HOSTNAME); // only works with DHCP.... WiFi.begin(WIFI_SSID, WIFI_PASSWORD); unsigned long startAttemptTime = millis();