mirror of
https://github.com/meshtastic/firmware.git
synced 2026-11-07 23:04:49 -05:00
Slot parity: drop the build-time node default
A slot parity is something a module asks for on a packet it is queueing, not a property of a build. Remove MESHTASTIC_TX_SLOT_PARITY and its validation guard; getTxDelayMsec() now takes the parity from the TX hooks alone, and a node whose packets no module speaks for keeps the ordinary random draw. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MkrqYBzhAxyybmoezb1TJV
This commit is contained in:
1 parent
958242e8b5
commit
e0337afa0e
1 file changed
+1
-11
@@ -821,10 +821,6 @@ uint32_t RadioInterface::getRetransmissionMsec(const meshtastic_MeshPacket *p)
|
||||
PROCESSING_TIME_MSEC;
|
||||
}
|
||||
|
||||
#if defined(MESHTASTIC_TX_SLOT_PARITY) && (MESHTASTIC_TX_SLOT_PARITY + 0) != 0 && (MESHTASTIC_TX_SLOT_PARITY + 0) != 1
|
||||
#error "MESHTASTIC_TX_SLOT_PARITY is this node's default slot parity: build with =0 (even) or =1 (odd)"
|
||||
#endif
|
||||
|
||||
/** The delay to use when we want to send something */
|
||||
uint32_t RadioInterface::getTxDelayMsec(const meshtastic_MeshPacket *p)
|
||||
{
|
||||
@@ -834,13 +830,7 @@ uint32_t RadioInterface::getTxDelayMsec(const meshtastic_MeshPacket *p)
|
||||
float channelUtil = airTime->channelUtilizationPercent();
|
||||
uint8_t CWsize = map(channelUtil, 0, 100, CWmin, CWmax);
|
||||
// LOG_DEBUG("Current channel utilization is %f so setting CWsize to %d", channelUtil, CWsize);
|
||||
meshtastic_SlotParity parity = RadioTxHooks::slotParity(p);
|
||||
#ifdef MESHTASTIC_TX_SLOT_PARITY
|
||||
// A node-wide default for a node whose traffic no module speaks for - the far end of a stream
|
||||
// whose near end is a module asking for the other parity. Bench builds only; unset by default.
|
||||
if (parity == meshtastic_SlotParity_SLOT_PARITY_UNSET)
|
||||
parity = (MESHTASTIC_TX_SLOT_PARITY + 0) ? meshtastic_SlotParity_SLOT_PARITY_ODD : meshtastic_SlotParity_SLOT_PARITY_EVEN;
|
||||
#endif
|
||||
const meshtastic_SlotParity parity = RadioTxHooks::slotParity(p);
|
||||
if (parity != meshtastic_SlotParity_SLOT_PARITY_UNSET)
|
||||
return getAnchoredSlotDelayMsec(pow_of_2(CWsize), parity);
|
||||
return random(0, pow_of_2(CWsize)) * slotTimeMsec;
|
||||
|
||||
Reference in new issue
Block a user