fix wifi manager web_api add component
This commit is contained in:
parent
e901cb944f
commit
2ca28645d6
|
|
@ -36,4 +36,5 @@ idf_component_register(
|
||||||
json
|
json
|
||||||
lwip
|
lwip
|
||||||
mdns
|
mdns
|
||||||
|
mbedtls
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -195,9 +195,9 @@ esp_err_t wifi_manager_start_ap(void)
|
||||||
|
|
||||||
// AP-IP konfigurieren
|
// AP-IP konfigurieren
|
||||||
esp_netif_ip_info_t ip_info;
|
esp_netif_ip_info_t ip_info;
|
||||||
IP4_ADDR(&ip_info.ip, 192, 168, 4, 1);
|
esp_ip4addr_aton("192.168.4.1", &ip_info.ip);
|
||||||
IP4_ADDR(&ip_info.gw, 192, 168, 4, 1);
|
esp_ip4addr_aton("192.168.4.1", &ip_info.gw);
|
||||||
IP4_ADDR(&ip_info.netmask, 255, 255, 255, 0);
|
esp_ip4addr_aton("255.255.255.0", &ip_info.netmask);
|
||||||
|
|
||||||
esp_netif_dhcps_stop(s_netif_ap);
|
esp_netif_dhcps_stop(s_netif_ap);
|
||||||
esp_netif_set_ip_info(s_netif_ap, &ip_info);
|
esp_netif_set_ip_info(s_netif_ap, &ip_info);
|
||||||
|
|
@ -254,16 +254,16 @@ esp_err_t wifi_manager_connect(const wifi_config_data_t* config)
|
||||||
esp_netif_ip_info_t ip_info;
|
esp_netif_ip_info_t ip_info;
|
||||||
memset(&ip_info, 0, sizeof(ip_info));
|
memset(&ip_info, 0, sizeof(ip_info));
|
||||||
|
|
||||||
ip4addr_aton(config->static_ip, (ip4_addr_t*)&ip_info.ip);
|
esp_ip4addr_aton(config->static_ip, &ip_info.ip);
|
||||||
ip4addr_aton(config->gateway, (ip4_addr_t*)&ip_info.gw);
|
esp_ip4addr_aton(config->gateway, &ip_info.gw);
|
||||||
ip4addr_aton(config->netmask, (ip4_addr_t*)&ip_info.netmask);
|
esp_ip4addr_aton(config->netmask, &ip_info.netmask);
|
||||||
|
|
||||||
esp_netif_set_ip_info(s_netif_sta, &ip_info);
|
esp_netif_set_ip_info(s_netif_sta, &ip_info);
|
||||||
|
|
||||||
// DNS konfigurieren wenn vorhanden
|
// DNS konfigurieren wenn vorhanden
|
||||||
if (strlen(config->dns) > 0) {
|
if (strlen(config->dns) > 0) {
|
||||||
esp_netif_dns_info_t dns;
|
esp_netif_dns_info_t dns;
|
||||||
ip4addr_aton(config->dns, (ip4_addr_t*)&dns.ip.u_addr.ip4);
|
esp_ip4addr_aton(config->dns, &dns.ip.u_addr.ip4);
|
||||||
dns.ip.type = ESP_IPADDR_TYPE_V4;
|
dns.ip.type = ESP_IPADDR_TYPE_V4;
|
||||||
esp_netif_set_dns_info(s_netif_sta, ESP_NETIF_DNS_MAIN, &dns);
|
esp_netif_set_dns_info(s_netif_sta, ESP_NETIF_DNS_MAIN, &dns);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue