Merge branch 'bugfix/tw15595_eth_got_ip_log_error' into 'master'

esp32/tcpipadapter: correct eth ip got event info

See merge request !1388
This commit is contained in:
Jiang Jiang Jian 2017-10-16 17:30:14 +08:00
commit 99f2996779
3 changed files with 21 additions and 4 deletions

View file

@ -61,6 +61,7 @@ static esp_err_t system_event_eth_start_handle_default(system_event_t *event);
static esp_err_t system_event_eth_stop_handle_default(system_event_t *event);
static esp_err_t system_event_eth_connected_handle_default(system_event_t *event);
static esp_err_t system_event_eth_disconnected_handle_default(system_event_t *event);
static esp_err_t system_event_eth_got_ip_default(system_event_t *event);
/* Default event handler functions
@ -124,11 +125,21 @@ esp_err_t system_event_eth_disconnected_handle_default(system_event_t *event)
return ESP_OK;
}
static esp_err_t system_event_eth_got_ip_default(system_event_t *event)
{
ESP_LOGI(TAG, "eth ip: " IPSTR ", mask: " IPSTR ", gw: " IPSTR,
IP2STR(&event->event_info.got_ip.ip_info.ip),
IP2STR(&event->event_info.got_ip.ip_info.netmask),
IP2STR(&event->event_info.got_ip.ip_info.gw));
return ESP_OK;
}
static esp_err_t system_event_sta_got_ip_default(system_event_t *event)
{
WIFI_API_CALL_CHECK("esp_wifi_internal_set_sta_ip", esp_wifi_internal_set_sta_ip(), ESP_OK);
ESP_LOGI(TAG, "ip: " IPSTR ", mask: " IPSTR ", gw: " IPSTR,
ESP_LOGI(TAG, "sta ip: " IPSTR ", mask: " IPSTR ", gw: " IPSTR,
IP2STR(&event->event_info.got_ip.ip_info.ip),
IP2STR(&event->event_info.got_ip.ip_info.netmask),
IP2STR(&event->event_info.got_ip.ip_info.gw));
@ -414,4 +425,5 @@ void esp_event_set_default_eth_handlers()
default_event_handlers[SYSTEM_EVENT_ETH_STOP] = system_event_eth_stop_handle_default;
default_event_handlers[SYSTEM_EVENT_ETH_CONNECTED] = system_event_eth_connected_handle_default;
default_event_handlers[SYSTEM_EVENT_ETH_DISCONNECTED] = system_event_eth_disconnected_handle_default;
default_event_handlers[SYSTEM_EVENT_ETH_GOT_IP] = system_event_eth_got_ip_default;
}

View file

@ -11,7 +11,7 @@ config DMA_RX_BUF_NUM
If enable flow ctrl, the num must be above 9 .
config DMA_TX_BUF_NUM
int "Number of DMA RX buffers"
int "Number of DMA TX buffers"
range 3 20
default 10
help

View file

@ -756,8 +756,13 @@ static void tcpip_adapter_dhcpc_cb(struct netif *netif)
ip4_addr_set(&ip_info->gw, ip_2_ip4(&netif->gw));
//notify event
evt.event_id = SYSTEM_EVENT_STA_GOT_IP;
evt.event_info.got_ip.ip_changed = false;
if (tcpip_if == TCPIP_ADAPTER_IF_ETH) {
evt.event_id = SYSTEM_EVENT_ETH_GOT_IP;
evt.event_info.got_ip.ip_changed = true;
} else {
evt.event_id = SYSTEM_EVENT_STA_GOT_IP;
evt.event_info.got_ip.ip_changed = false;
}
if (memcmp(ip_info, ip_info_old, sizeof(tcpip_adapter_ip_info_t))) {
evt.event_info.got_ip.ip_changed = true;