event: not post got ip event if static is invalid
This commit is contained in:
parent
df53d1588a
commit
80d60270bb
1 changed files with 10 additions and 5 deletions
|
@ -143,15 +143,20 @@ esp_err_t system_event_sta_connected_handle_default(system_event_t *event)
|
||||||
tcpip_adapter_dhcpc_start(TCPIP_ADAPTER_IF_STA);
|
tcpip_adapter_dhcpc_start(TCPIP_ADAPTER_IF_STA);
|
||||||
} else if (status == TCPIP_ADAPTER_DHCP_STOPPED) {
|
} else if (status == TCPIP_ADAPTER_DHCP_STOPPED) {
|
||||||
tcpip_adapter_ip_info_t sta_ip;
|
tcpip_adapter_ip_info_t sta_ip;
|
||||||
system_event_t evt;
|
|
||||||
|
|
||||||
tcpip_adapter_get_ip_info(TCPIP_ADAPTER_IF_STA, &sta_ip);
|
tcpip_adapter_get_ip_info(TCPIP_ADAPTER_IF_STA, &sta_ip);
|
||||||
|
|
||||||
|
if (!(ip4_addr_isany_val(sta_ip.ip) || ip4_addr_isany_val(sta_ip.netmask) || ip4_addr_isany_val(sta_ip.gw))) {
|
||||||
|
system_event_t evt;
|
||||||
|
|
||||||
//notify event
|
//notify event
|
||||||
evt.event_id = SYSTEM_EVENT_STA_GOTIP;
|
evt.event_id = SYSTEM_EVENT_STA_GOTIP;
|
||||||
memcpy(&evt.event_info.got_ip.ip_info, &sta_ip, sizeof(tcpip_adapter_ip_info_t));
|
memcpy(&evt.event_info.got_ip.ip_info, &sta_ip, sizeof(tcpip_adapter_ip_info_t));
|
||||||
|
|
||||||
esp_event_send(&evt);
|
esp_event_send(&evt);
|
||||||
|
} else {
|
||||||
|
WIFI_DEBUG("invalid static ip\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
|
|
Loading…
Reference in a new issue