Pass meshtastic_MeshPacket down into startTransmitTimerRebroadcast and getTxDelayMsecWeighted

This commit is contained in:
Mike Robbins
2025-09-05 13:53:59 -07:00
parent 7e00054fd7
commit 3cc2b70e4f
6 changed files with 11 additions and 11 deletions

View File

@@ -310,7 +310,7 @@ void RadioLibInterface::setTransmitDelay()
// So we want to make sure the other side has had a chance to reconfigure its radio.
if (p->tx_after) {
unsigned long add_delay = p->rx_rssi ? getTxDelayMsecWeighted(p->rx_snr) : getTxDelayMsec();
unsigned long add_delay = p->rx_rssi ? getTxDelayMsecWeighted(p->rx_snr, p) : getTxDelayMsec();
unsigned long now = millis();
p->tx_after = min(max(p->tx_after + add_delay, now + add_delay), now + 2 * getTxDelayMsecWeightedWorst(p->rx_snr));
notifyLater(p->tx_after - now, TRANSMIT_DELAY_COMPLETED, false);
@@ -323,7 +323,7 @@ void RadioLibInterface::setTransmitDelay()
} else {
// If there is a SNR, start a timer scaled based on that SNR.
LOG_DEBUG("rx_snr found. hop_limit:%d rx_snr:%f", p->hop_limit, p->rx_snr);
startTransmitTimerRebroadcast(p->rx_snr);
startTransmitTimerRebroadcast(p->rx_snr, p);
}
}
@@ -336,11 +336,11 @@ void RadioLibInterface::startTransmitTimer(bool withDelay)
}
}
void RadioLibInterface::startTransmitTimerRebroadcast(float snr)
void RadioLibInterface::startTransmitTimerRebroadcast(float snr, meshtastic_MeshPacket *p)
{
// If we have work to do and the timer wasn't already scheduled, schedule it now
if (!txQueue.empty()) {
uint32_t delay = getTxDelayMsecWeighted(snr);
uint32_t delay = getTxDelayMsecWeighted(snr, p);
notifyLater(delay, TRANSMIT_DELAY_COMPLETED, false); // This will implicitly enable
}
}