1313
1414/*Set the SSID and Password via "make menuconfig"*/
1515#define DEFAULT_SSID CONFIG_WIFI_SSID
16- #define DEFAULT_PASS CONFIG_WIFI_PASSWORD
16+ #define DEFAULT_PASSWORD CONFIG_WIFI_PASSWORD
17+ #define DEFAULT_HOSTNAME CONFIG_WIFI_HOSTNAME
1718
1819char wifi0_mac_str [18 ] = {0 };
1920
@@ -35,7 +36,7 @@ void wifi0_init(void)
3536 wifi_config_t wifi_config = {
3637 .sta = {
3738 .ssid = DEFAULT_SSID ,
38- .password = DEFAULT_PASS ,
39+ .password = DEFAULT_PASSWORD ,
3940 .scan_method = WIFI_ALL_CHANNEL_SCAN ,
4041 .sort_method = WIFI_CONNECT_AP_BY_SIGNAL ,
4142 .threshold .rssi = -127 ,
@@ -46,8 +47,8 @@ void wifi0_init(void)
4647 ESP_ERROR_CHECK (esp_wifi_set_mode (WIFI_MODE_STA ));
4748 ESP_ERROR_CHECK (esp_wifi_set_config (ESP_IF_WIFI_STA , & wifi_config ));
4849 ESP_ERROR_CHECK (esp_wifi_start ());
49-
5050 uint8_t wifi0_mac [6 ] = {0 };
5151 ESP_ERROR_CHECK (esp_wifi_get_mac (ESP_IF_WIFI_STA , wifi0_mac ));
5252 snprintf (wifi0_mac_str , sizeof (wifi0_mac_str ), MACSTR , MAC2STR (wifi0_mac ));
53+ ESP_ERROR_CHECK (tcpip_adapter_set_hostname (TCPIP_ADAPTER_IF_STA , CONFIG_WIFI_HOSTNAME ));
5354}
0 commit comments