zhaohe 1 year ago
parent
commit
70275ccacb
  1. 4
      README.md
  2. 2
      usrc/project_configs.h
  3. 16
      usrc/service/network_service.c

4
README.md

@ -16,6 +16,10 @@ V3.1
1.电源部分的指示灯显示IP获取状态
2.调整广播时间,优化复位逻辑
V3.3
1.修改dhcp启动的位置
2.修正网卡启动时,如果没有插网线,设备无法初始化的BUG
```
···

2
usrc/project_configs.h

@ -1,7 +1,7 @@
#pragma once
#define VERSION(main, sub, fix) (main << 16 | sub << 8 | fix << 0)
#define PC_VERSION VERSION(3, 2, 0)
#define PC_VERSION VERSION(3, 3, 0)
#define PC_MANUFACTURER0 ('i' | 'f' << 8 | 'l' << 16 | 'y' << 24)
#define PC_MANUFACTURER1 ('t' | 'o' << 8 | 'p' << 16 | '\0' << 24)

16
usrc/service/network_service.c

@ -42,6 +42,7 @@ static uint8_t GATEWAY_ADDRESS[4];
static bool m_networkisready;
static config_t config_cache;
static bool dhcp_is_start;
uint8_t g_mac[6];
@ -101,6 +102,11 @@ void netif_ext_callback(struct netif *netif, netif_nsc_reason_t reason, const ne
// netif_set_addr(netif, &ipaddr, &netmask, &gw);
// m_networkisready = false;
// }
if (!dhcp_is_start) {
dhcp_start(&gnetif);
dhcp_is_start = true;
}
if (args->link_changed.state) {
if (netif->ip_addr.addr != 0) {
m_networkisready = true;
@ -174,12 +180,10 @@ void network_service_init() {
osThreadDef(EthLink, ethernet_link_thread, NETWORK_REPORT_TASK_LEVEL, 0, 1024);
osThreadCreate(osThread(EthLink), &gnetif);
while (!netif_is_up(&gnetif)) {
ZLOGI(TAG, "waiting for dhcp");
osDelay(100);
}
dhcp_start(&gnetif);
// while (!netif_is_up(&gnetif)) {
// ZLOGI(TAG, "waiting for dhcp");
// osDelay(100);
// }
}
}

Loading…
Cancel
Save