From e0337afa0eb5271afa82c792ccc8f036fd1b062a Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Wed, 30 Sep 2026 02:21:17 +0000 Subject: [PATCH] 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 Claude-Session: https://claude.ai/code/session_01MkrqYBzhAxyybmoezb1TJV --- src/mesh/RadioInterface.cpp | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/mesh/RadioInterface.cpp b/src/mesh/RadioInterface.cpp index d2535724b4..a5e7e784e0 100644 --- a/src/mesh/RadioInterface.cpp +++ b/src/mesh/RadioInterface.cpp @@ -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;