martin-ger / esp_wifi_repeater

A full functional WiFi Repeater (correctly: a WiFi NAT Router)
MIT License
4.83k stars 909 forks source link

ESP8266 restart automatically in AUTOMESH mode #208

Open wfs1900 opened 6 years ago

wfs1900 commented 6 years ago

It seems the issue happened here: if (evt->event_info.connected.bssid[i] != config.bssid[i]) { wrong_bssid = true; os_printf("connect to non configured bssid!"); break; } but i cannot figure out what is the reason, what is the "config.bssid"?

martin-ger commented 6 years ago

The problem ist the following:

In Automesh mode a node selects a special other node to be its "parent", this is the node with the the best signal strength and the least distance to the root. This node is found by an initial scan. Then it tries to connect to this node by setting the BSSID (the MAC address) of the desired AP. For some reason (in the driver?) this fails sometimes (the ESP still connects to another AP with the same SSID, not the one with the selected BSSID). If this happens, it tries again by resetting until it is connected to the right AP.

So the problem is: why doesn't it resepect the chosen BSSID...?

wfs1900 commented 6 years ago

ESP8266 at mesh layer2 always prints out: connected with ESD_TEST, channel 6 dhcp client start... connect to ssid ESD_TEST, bssid 24:24:01:d2:08:f2, channel 6 connect to non configured bssid!Saving configuration state: 5 -> 0 (0) rm 0 del if0 bcn 0 del if1 usl disconnect from ssid ESD_TEST, reason 8


and ESP8266 at mesh layer1 prints out: station: 84:f3:eb:4e:2d:c8 join, AID = 1 station: 84:f3:eb:4e:2d:c8 join, AID = 1 station: 84:f3:eb:4e:2d:c8 leave, AID = 1 rm 1 station: 84:f3:eb:4e:2d:c8 leave, AID = 1

martin-ger commented 6 years ago

So the ESP at mesh layer2 probaly want's to connect to the original root AP (the same as the ESP at mesh layer 1)? I have this problem sometimes, when the two ESP are right side-by-side. Both see the root AP and decide, that it would be the best to connect directly. However, the second then actually connects to the first ESP - and this causes the reset, as this is not what was intended to do...

wfs1900 commented 6 years ago

Yes, my two esp8266 placed side by side, I also thinking that may be the reason. Is it possible the problem is in the comparison process for RSSI,this is my guess.

martin-ger commented 6 years ago

Perhaps you could try it again with the second node really far away from the root node?

wfs1900 commented 6 years ago

OK, I test the following scenes: 1、Placed first node near the root node and second node in another room , make it near the first node; ==>FAIL 2、Placed both of two nodes in another room and make them a distance apart; ==>FAIL 3、Placed first node near the root node and second node with automesh off, the second node connect with first node successfully;