tcpip_adapter: clean up dhcpc status

only auto start dhcpc in init status
This commit is contained in:
Wu Jian Gang
2016-08-26 11:52:46 +08:00
parent f81535a840
commit cb33a0fb9b
2 changed files with 12 additions and 2 deletions

View File

@@ -116,10 +116,17 @@ esp_err_t system_event_sta_stop_handle_default(system_event_t *event)
esp_err_t system_event_sta_connected_handle_default(system_event_t *event)
{
tcpip_adapter_dhcp_status_t status;
WIFI_API_CALL_CHECK("esp_wifi_reg_rxcb", esp_wifi_reg_rxcb(WIFI_IF_STA, (wifi_rxcb_t)tcpip_adapter_sta_input), ESP_OK);
tcpip_adapter_up(TCPIP_ADAPTER_IF_STA);
tcpip_adapter_dhcpc_start(TCPIP_ADAPTER_IF_STA);
tcpip_adapter_dhcpc_get_status(TCPIP_ADAPTER_IF_STA, &status);
if (status == TCPIP_ADAPTER_DHCP_INIT) {
tcpip_adapter_dhcpc_start(TCPIP_ADAPTER_IF_STA);
}
return ESP_OK;
}