Closed peros550 closed 4 years ago
It seems to be irrelevant to wifi configuration. What stops you from doing it in your user_init() function prior to initializing wifi_config ?
#include <esp_system.h>
#include <lwip/dhcp.h>
void user_init() {
uart_set_baud(0, 115200);
struct netif *netif = sdk_system_get_netif(STATION_IF);
if (netif) {
LOCK_TCPIP_CORE();
dhcp_release_and_stop(netif);
netif->hostname = "foobar";
dhcp_start(netif);
UNLOCK_TCPIP_CORE();
}
}
I agree with @maximkulkin . It does not make sense to include in esp-wifi-config. In my firmware, I include it into setup-mode library (called wifi-config-haa), but it is an approach totally different of esp-wifi-config library.
Didn't realize it was that simple :-) Best Regards to All
With this PR I'm attempting to bring custom hostnames into esp-wifi-config. I found the code at RavenSystem/haa repository and thought it would be helpful to have this into the rest custom homekit devices.
I have altered the definition of wifi_config_init2 function. This will put users who are using this version of init to re-write their code.
If this is not acceptable, then someone may propose a different way.
At the homekit accessory makefile, I also put the following: EXTRA_CFLAGS += -DLWIP_NETIF_HOSTNAME=1