mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-09 06:32:06 +00:00
Allow FloodingRouter to repeat heard packets if airtime allows
This change should increase reliability of sparse meshes without affecting busy ones.
This commit is contained in:
parent
41c1b29d70
commit
c395f8af30
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
#include "mesh-pb-constants.h"
|
#include "mesh-pb-constants.h"
|
||||||
|
#include "airtime.h"
|
||||||
|
|
||||||
FloodingRouter::FloodingRouter() {}
|
FloodingRouter::FloodingRouter() {}
|
||||||
|
|
||||||
@ -48,10 +49,14 @@ void FloodingRouter::perhapsCancelDupe(const meshtastic_MeshPacket *p)
|
|||||||
if (config.device.role != meshtastic_Config_DeviceConfig_Role_ROUTER &&
|
if (config.device.role != meshtastic_Config_DeviceConfig_Role_ROUTER &&
|
||||||
config.device.role != meshtastic_Config_DeviceConfig_Role_REPEATER &&
|
config.device.role != meshtastic_Config_DeviceConfig_Role_REPEATER &&
|
||||||
config.device.role != meshtastic_Config_DeviceConfig_Role_ROUTER_LATE) {
|
config.device.role != meshtastic_Config_DeviceConfig_Role_ROUTER_LATE) {
|
||||||
// cancel rebroadcast of this message *if* there was already one, unless we're a router/repeater!
|
// Repeater roles should always rebroadcast.
|
||||||
|
if (!airTime->isTxAllowedAirUtil() && !airTime->isTxAllowedChannelUtil(true)) {
|
||||||
|
// Other rebroadcasting roles should rebroadcast if there's available airtime
|
||||||
|
// This keeps small and sparse meshes more reliable and attenuates congestion in busy ones
|
||||||
if (Router::cancelSending(p->from, p->id))
|
if (Router::cancelSending(p->from, p->id))
|
||||||
txRelayCanceled++;
|
txRelayCanceled++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (config.device.role == meshtastic_Config_DeviceConfig_Role_ROUTER_LATE && iface) {
|
if (config.device.role == meshtastic_Config_DeviceConfig_Role_ROUTER_LATE && iface) {
|
||||||
iface->clampToLateRebroadcastWindow(getFrom(p), p->id);
|
iface->clampToLateRebroadcastWindow(getFrom(p), p->id);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user