From c1730253b428edb0c247d25cf5cd56dbbc02b65e Mon Sep 17 00:00:00 2001 From: zhaohe Date: Tue, 26 Mar 2024 10:30:29 +0800 Subject: [PATCH] v3.1 --- README.md | 2 ++ usrc/project_configs.h | 2 +- usrc/service/network_service.c | 21 ++++++++++++++------- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 7504b65..931e0b3 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,8 @@ V3 3.修改xsynctimecode消息上报格式 4.添加dhcp支持 5.dhcp失败自动触发LLA,生成随机本地IP +V3.1 + 1.电源部分的指示灯显示IP获取状态 ``` diff --git a/usrc/project_configs.h b/usrc/project_configs.h index 2088da5..2a7eb45 100644 --- a/usrc/project_configs.h +++ b/usrc/project_configs.h @@ -1,6 +1,6 @@ #pragma once -#define PC_VERSION (3 | 0 | 0 | 0) // main/sub/fix +#define PC_VERSION (3 | 1 | 0 | 0) // main/sub/fix #define PC_MANUFACTURER0 ('i' | 'f' << 8 | 'l' << 16 | 'y' << 24) #define PC_MANUFACTURER1 ('t' | 'o' << 8 | 'p' << 16 | '\0' << 24) #define PC_PROJECT_NAME "xsync" diff --git a/usrc/service/network_service.c b/usrc/service/network_service.c index f74ab71..edb702b 100644 --- a/usrc/service/network_service.c +++ b/usrc/service/network_service.c @@ -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)) {