Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/mesh/RadioInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,10 +251,11 @@ uint32_t RadioInterface::getRetransmissionMsec(const meshtastic_MeshPacket *p)
uint32_t packetAirtime = getPacketTime(numbytes + sizeof(PacketHeader));
// Make sure enough time has elapsed for this packet to be sent and an ACK is received.
// LOG_DEBUG("Waiting for flooding message with airtime %d and slotTime is %d", packetAirtime, slotTimeMsec);
float channelUtil = airTime->channelUtilizationPercent();
uint8_t CWsize = map(channelUtil, 0, 100, CWmin, CWmax);
// Assuming we pick max. of CWsize and there will be a client with SNR at half the range
return 2 * packetAirtime + (pow_of_2(CWsize) + 2 * CWmax + pow_of_2(int((CWmax + CWmin) / 2))) * slotTimeMsec +
// Account for worst-case ROUTER_LATE delay: (2 * CWmax + pow_of_2(CWmax)) * slotTimeMsec
// ROUTER_LATE uses SNR-based CWsize independent of channel util, so we must assume CWmax for both terms
// to ensure timeout is always longer than the maximum possible ROUTER_LATE rebroadcast delay.
// This prevents MAX_RETRANSMIT errors when ROUTER_LATE nodes successfully rebroadcast but with delay.
return 2 * packetAirtime + (2 * pow_of_2(CWmax) + 2 * CWmax) * slotTimeMsec +
PROCESSING_TIME_MSEC;
}

Expand Down
Loading