Chapter 4. API Guides
Root Node Switching
ESP-WIFI-MESH does not automatically switch the root node unless the root node breaks down. Even if the root
node' s router RSSI degrades to the point of disconnection, the root node will remain unchanged. Root node switching
is the act of explicitly starting a new election such that a node with a stronger router RSSI will be elected as the new
root node. This can be a useful method of adapting to degrading root node performance.
To trigger a root node switch, the current root node must explicitly call
esp_mesh_waive_root()
to trigger a
new election. The current root node will signal all nodes within the network to begin transmitting and scanning for
beacon frames (see
Automatic Root Node
Selection) whilst remaining connected to the network (i.e. not idle). If
another node receives more votes than the current root node, a root node switch will be initiated. The root node will
remain unchanged otherwise.
A newly elected root node sends a switch request to the current root node which in turn will respond with an
acknowledgment signifying both nodes are ready to switch. Once the acknowledgment is received, the newly elected
root node will disconnect from its parent and promptly form an upstream connection with the router thereby becoming
the new root node of the network. The previous root node will disconnect from the router whilst maintaining all of
its downstream connections and enter the idle state. The previous root node will then begin scanning for potential
parent nodes and selecting a preferred parent.
The following diagram illustrates an example of a root node switch.
Fig. 16: Root Node Switch Example
1. Node C is the current root node but has degraded signal strength with the router (-85db). The node C triggers a
new election and all nodes begin transmitting and scanning for beacon frames whilst still being connected.
2. After multiple rounds of transmission and scanning, node B is elected as the new root node. Node B sends node
C a switch request and node C responds with an acknowledgment.
3. Node B disconnects from its parent and connects with the router becoming the network' s new root node. Node C
disconnects from the router, enters the idle state, and begins scanning for and selecting a new preferred parent node.
Node C maintains all its downstream connections throughout this process.
4. Node C selects node B as its preferred parent node, forms an upstream connection, and becomes a second layer
node. The network layout is similar after the switch as node C still maintains the same subnetwork. However each
node in node C's subnetwork has been placed one layer deeper as a result of the switch.
Parent Node Switching
may
adjust the network layout afterwards if any nodes have a new preferred parent node as a result of the root node switch.
Espressif Systems
1320
Release v4.4
Submit Document Feedback
Need help?
Do you have a question about the ESP32-S2 and is the answer not in the manual?
Questions and answers