Skip to content

Commit

Permalink
Set up hostname earlier in WiFi init to ensure it is applied to DHCP …
Browse files Browse the repository at this point in the history
…client name
  • Loading branch information
mairas committed Jul 25, 2024
1 parent ea7f3bc commit 82efdd9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/sensesp/net/networking.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#include "sensesp.h"

#include "networking.h"

#include <esp_wifi.h>

#include "sensesp.h"
#include "sensesp/system/led_blinker.h"
#include "sensesp_app.h"

Expand Down Expand Up @@ -53,11 +54,14 @@ Networking::Networking(String config_path, String client_ssid,
// complicated with enforced WPA2. BAD Raspberry Pi! BAD!
WiFi.setMinSecurity(WIFI_AUTH_WPA_PSK);

// Try setting hostname already here.
String hostname = SensESPBaseApp::get_hostname();
WiFi.setHostname(hostname.c_str());

// Start WiFi with a bogus SSID to initialize the network stack but
// don't connect to any network.
WiFi.begin("0", "0", 0, nullptr, false);


// If both saved AP settings and saved client settings
// are available, start in STA+AP mode.

Expand Down

0 comments on commit 82efdd9

Please sign in to comment.