Skip to content

Commit

Permalink
fix: set hostname before mode
Browse files Browse the repository at this point in the history
See espressif/arduino-esp32#6278, setHostname needs to be called before setting the wifi  mode cause otherwise it will not / not always be set correctly
  • Loading branch information
pimlie authored Jul 17, 2024
1 parent 5ee5660 commit 0629f54
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 0629f54

Please sign in to comment.