feat(mesh): Shift mobile roles contention window to lower priority (10687)
This is the proposed code for issue 10687.
It shifts all non infrastructure role's contention window to a later frame. This should allow infrastructure to have priority and reduce client retransmissions in dense meshes.
I tried a couple of other approaches but settled on this. It provides a predictable behavior with no (theoretical) impact on the existing retry logic.
- [X] I have tested that my proposed changes behave as described.
- [X] I have tested that my proposed changes do not cause any obvious regressions on the following devices:
- [X] Heltec (Lora32) V3
- [X] Other (please specify below) Muzi R1 Neo
Using the serial debug output I was able to confirm that the expected wait times were upheld even at extreme SNRs. With an SDR I was able to confirm that retransmissions still happen. Finally I have been using the modified code on my daily driven R1 Neo with no obvious problems.
@luivicur, Welcome to Meshtastic!
Thanks for opening your first pull request. We really appreciate it.
We discuss work as a team in discord, please join us in the #firmware channel. There's a big backlog of patches at the moment. If you have time, please help us with some code review and testing of other PRs!
Welcome to the team :smile:
This has a large impact on messaging in general. It means all messages transmitted by mobile roles (which is the default!) will be delayed (even more), only for
CLIENT_BASEnodes to get priority. Given thatCLIENT_BASEis a very specific role, I don't think this is worth it. It might simply be you need to use another role then.
The conversation goes a little deeper into the why's: https://github.com/meshtastic/firmware/issues/10687 The proposed delay is 1 second in long fast. I consider the benefits worth the delay. Client_base should be the most common infrastructure role in a large mesh.
Alternatively,
CLIENT_BASEcould get a slightly less delay than mobile nodes, e.g.delay = (1 * CWmax) + random(0, pow_of_2(CWsize)), so it doesn't impact the delay of mobile nodes.
This does impact the probability of collision with router nodes.
Don't assume everyone runs a large infrastructure mesh. Or change timing values without proper simulation. This impacts use cases (popular ones) that are not covered by 'large infrastructure mesh'.
Understood and taken into account. I don't believe an extra 1s delay (in longfast) is a deal breaker. The impact is only in rebroadcasts, direct connections are not affected. The proposal allows tuning by lowering the wait time.
I played around with an artificial play on the SNR but this provided the most consistent results.
Other ideas on how to make Client better behaved under both infrastructure and ad-hoc are welcome in the issue https://github.com/meshtastic/firmware/issues/10687
Going over my numbers again, using 64 slotTimes pretty much guaranteed that clients would transmit after client_base in all scenarios. Reducing it to 32 slotTimes (0.5s in LongFast) still clears most cases while significantly reducing the impact.
It looks to me like a good compromise to make client a more flexible role.