diff --git a/docs/developers/Firmware/mesh-alg.mdx b/docs/developers/Firmware/mesh-alg.mdx index 598147d2..78e7b26c 100644 --- a/docs/developers/Firmware/mesh-alg.mdx +++ b/docs/developers/Firmware/mesh-alg.mdx @@ -72,4 +72,13 @@ If a transmitting node does not receive an ACK (or NAK) packet after a certain e Given our use-case for the initial release, most of our protocol is built around [flooding](). The implementation is currently 'naive' and doesn't try to optimize flooding, except by abandoning retransmission once a node has seen a nearby receiver ACK the packet it's trying to flood. This means that up to N retransmissions of a packet could occur in an N node mesh. -If any mesh node sees a packet with a HopLimit other than zero, it will decrement that HopLimit and attempt retransmission on behalf of the original sending node. In order to promote letting nodes that are further away flood the message, such that the message eventually reaches farther, the contention window (see Layer 1) for a flooding message depends on the Signal-to-Noise Ratio (SNR) of the received packet. The CW size is small for a low SNR, such that nodes that are further away are more likely to flood first and closer nodes that hear this will refrain from flooding. \ No newline at end of file +If any mesh node sees a packet with a HopLimit other than zero, it will decrement that HopLimit and attempt retransmission on behalf of the original sending node. In order to promote letting nodes that are further away flood the message, such that the message eventually reaches farther, the contention window (see Layer 1) for a flooding message depends on the Signal-to-Noise Ratio (SNR) of the received packet. The CW size is small for a low SNR, such that nodes that are further away are more likely to flood first and closer nodes that hear this will refrain from flooding. + +### Example + +Below you see an example topology consisting of four nodes, where at a certain point node 0 wants to send a broadcast message. +Due to limited coverage, it only reaches nodes 1 and 2. Since node 2 is farther away, its SNR is lower and therefore starts rebroadcasting earlier than 1. +After node 0 received this rebroadcast, its message is acknowledged. Note that a message is already acknowledged once a rebroadcast from any Meshtastic node (whether or not it has the same encryption key) is received. +Since node 1 heard the rebroadcast by 2, it will not rebroadcast again. Node 3 heard the message for the first time and the HopLimit is not yet zero, so it starts a rebroadcast for potential other receivers. + +![Mesh algorithm example](/img/SNR_based_flooding.png) \ No newline at end of file diff --git a/static/img/SNR_based_flooding.png b/static/img/SNR_based_flooding.png new file mode 100644 index 00000000..5e646f60 Binary files /dev/null and b/static/img/SNR_based_flooding.png differ