espressif / esp-mdf

Espressif Mesh Development Framework, limited maintain, recommend to use https://github.com/espressif/esp-mesh-lite
Other
766 stars 249 forks source link

mdf 的router例程根节点无法正常获取ip #307

Open yeqinggui opened 1 year ago

yeqinggui commented 1 year ago

硬件采用c3,测试例程为router,发现wifi 路由器重启后,根节点无法再次进入事件MDF_EVENT_MWIFI_ROOT_GOT_IP,parentmac打印出来都是0,日志如下: W (29830) wifi:m f probe req l=0

I (29837) wifi:new:<1,1>, old:<1,0>, ap:<1,1>, sta:<1,0>, prof:1 I (29842) wifi:state: init -> auth (b0) I (29846) [router_example, 2556]: Parent is disconnected on station interface h屙螰V?c弰)Hh屙R>FFBV#?HI (16138) [mwifi, 188]: Parent is disconnected, reason: 205wifi mesh: [wifi]disconnected reason:205(), continuous:4/max:12, root, vote(,stopped)<><> I (16139) [router_example, 2521]: event_loop_cb, event: 8 I (16148) [router_example, 2556]: Parent is disconnected on station interface I (16191) wifi:new:<1,1>, old:<1,0>, ap:<1,1>, sta:<1,0>, prof:1 I (16192) wifi:state: init -> auth (b0) I (16791) wifi:state: auth -> assoc (0) I (17348) wifi:state: assoc -> run (10) I (18441) wifi:connected with sk-wifi, aid = 1, channel 1, BW20, bssid = a4:39:b3:c8:52:f2 I (18442) wifi:security: WPA2-PSK, phy: bgn, rssi: -48 I (18444) wifi:pm start, type: 0

I (18447) wifi:set rx beacon pti, rx_bcn_pti: 0, bcn_timeout: 0, mt_pti: 25000, mt_time: 10000 I (18456) mesh: [scan]new scanning time:600ms, beacon interval:300ms I (18463) mesh: write layer:1 I (18464) [mwifi, 175]: Parent is connected I (18469) [mwifi, 258]: State represents: 0 I (18474) [router_example, 2521]: event_loop_cb, event: 7 I (18480) [router_example, 2530]: Parent is connected on station interface I (18487) [router_example, 2537]:

root  I (18475) mesh: upstream packets, connections(max):6, waiting:0, upQ:0 I (18494) [router_example, 2521]: event_loop_cb, event: 11 I (18505) [router_example, 2521]: event_loop_cb, event: 14 I (18512) [router_example, 2634]: root address  I (18517) wifi:BcnInt:102400, DTIM:1 I (18521) mesh: root I (18523) mesh: [TXQ]up(0, be:0), down(0, be:0), mgmt:0, xon(req:0, rsp:0), bcast:0, wnd(0, parent:00:00:00:00:00:00)

yeqinggui commented 1 year ago

image

yeqinggui commented 1 year ago

image

Jiangyafeng commented 1 year ago

@yeqinggui 请在 MDF_EVENT_MWIFI_PARENT_CONNECTED 时间里面添加如下操作: case MDF_EVENT_MWIFI_PARENT_CONNECTED: MDF_LOGI("Parent is connected on station interface"); if (esp_mesh_is_root()) { esp_netif_dhcpc_stop(netif_sta); esp_netif_dhcpc_start(netif_sta); } break;

yeqinggui commented 1 year ago

463bfe2116f57f3c76c98c7021462dc 试了一下,依然不行,一开始正常,重启wifi 路由器,就会出现这种情况

Jiangyafeng commented 1 year ago

建议您可以直接在 router demo 中加上上面的代码,做一下测试, link:https://github.com/espressif/esp-mdf/tree/master/examples/function_demo/mwifi/router