initial companion jitter lowering

This commit is contained in:
liquidraver
2026-05-05 14:52:12 +02:00
parent e8f14442bf
commit 28e12c7eef
2 changed files with 6 additions and 15 deletions
+3 -11
View File
@@ -1278,17 +1278,9 @@ uint32_t CompanionMesh::getDirectRetransmitDelay(const mesh::Packet *packet)
uint32_t CompanionMesh::getInitialFloodJitter(const mesh::Packet *packet)
{
float factor = getContentionTracker().getFloodDelayFactor();
uint32_t airtime = _radio->getEstAirtimeFor(
packet->getPathByteLen() + packet->payload_len + 2);
uint32_t max_jitter = (uint32_t)(5 * airtime * factor);
/* Companion spreads less aggressively than a repeater: half the
* airtime ceiling, and a tighter absolute cap (1000ms vs 2000ms). */
uint32_t airtime_cap = 3 * airtime;
if (max_jitter > airtime_cap) max_jitter = airtime_cap;
if (max_jitter > 1000) max_jitter = 1000;
if (max_jitter == 0) return 0;
return getRNG()->nextInt(0, max_jitter + 1);
(void)packet;
/* Fixed companion origin jitter window: 20..150ms (inclusive). */
return 20 + getRNG()->nextInt(0, 131);
}
uint8_t CompanionMesh::getDutyCyclePercent() const
+3 -4
View File
@@ -247,10 +247,9 @@ protected:
uint32_t getRetransmitDelay(const mesh::Packet *packet) override;
uint32_t getDirectRetransmitDelay(const mesh::Packet *packet) override;
/* Companion doesn't forward, but needs surroundings awareness so its
* initial TX spreads with local contention. Enables passive EMA
* warming and adaptive initial-flood jitter. */
bool passivelyTrackFloods() const override { return true; }
/* Companion initial flood jitter is fixed-window; passive flood
* tracking is not needed unless forwarding is enabled. */
bool passivelyTrackFloods() const override { return false; }
uint32_t getInitialFloodJitter(const mesh::Packet *packet) override;
uint8_t getDutyCyclePercent() const override;