|
|
@ -94,12 +94,19 @@ void netif_ext_callback(struct netif *netif, netif_nsc_reason_t reason, const ne |
|
|
|
|
|
|
|
if (reason & LWIP_NSC_LINK_CHANGED) { |
|
|
|
ZLOGI(TAG, "DHCP_MODE: LWIP_NSC_LINK_CHANGED %d", args->link_changed.state); |
|
|
|
if (!args->link_changed.state) { |
|
|
|
IP4_ADDR(&ipaddr, 0, 0, 0, 0); |
|
|
|
IP4_ADDR(&netmask, 0, 0, 0, 0); |
|
|
|
IP4_ADDR(&gw, 0, 0, 0, 0); |
|
|
|
netif_set_addr(netif, &ipaddr, &netmask, &gw); |
|
|
|
m_networkisready = false; |
|
|
|
// if (!args->link_changed.state) { |
|
|
|
// IP4_ADDR(&ipaddr, 0, 0, 0, 0); |
|
|
|
// IP4_ADDR(&netmask, 0, 0, 0, 0); |
|
|
|
// IP4_ADDR(&gw, 0, 0, 0, 0); |
|
|
|
// netif_set_addr(netif, &ipaddr, &netmask, &gw); |
|
|
|
// m_networkisready = false; |
|
|
|
// } |
|
|
|
if (args->link_changed.state) { |
|
|
|
if (netif->ip_addr.addr != 0) { |
|
|
|
m_networkisready = true; |
|
|
|
} |
|
|
|
}else{ |
|
|
|
m_networkisready = false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -164,7 +171,7 @@ void network_service_init() { |
|
|
|
netif_set_link_callback(&gnetif, ethernet_link_status_updated); |
|
|
|
netif_set_status_callback(&gnetif, ethernet_status_updated); |
|
|
|
netif_add_ext_callback(&extcb, netif_ext_callback); |
|
|
|
osThreadDef(EthLink, ethernet_link_thread, NETWORK_REPORT_TASK_LEVEL, 0, 512); |
|
|
|
osThreadDef(EthLink, ethernet_link_thread, NETWORK_REPORT_TASK_LEVEL, 0, 1024); |
|
|
|
osThreadCreate(osThread(EthLink), &gnetif); |
|
|
|
|
|
|
|
while (!netif_is_up(&gnetif)) { |
|
|
|