@@ -313,12 +313,24 @@ int SensorMesh::calcRxDelay(float score, uint32_t air_time) const {
313313}
314314
315315uint32_t SensorMesh::getRetransmitDelay (const mesh::Packet* packet) {
316+ if (_radio->isAS923_1_JP ()) {
317+ // JP LBT: suppress txdelay to jitter-scale to avoid adding unnecessary
318+ // latency on top of LBT backoff. A window equal to jitter_max gives
319+ // ~33% collision reduction vs zero, scales naturally with airtime as
320+ // CR changes, and keeps average added delay to ~56ms at SF12/BW125.
321+ uint32_t jitter_max = _radio->getEstAirtimeFor (MAX_TRANS_UNIT ) / RadioLibWrapper::JP_LBT_JITTER_DIVISOR ;
322+ return getRNG ()->nextInt (0 , jitter_max + 1 );
323+ }
316324 uint32_t t = (_radio->getEstAirtimeFor (packet->getPathByteLen () + packet->payload_len + 2 ) * _prefs.tx_delay_factor );
317- return getRNG ()->nextInt (0 , 6 )*t ;
325+ return getRNG ()->nextInt (0 , 5 *t + 1 ) ;
318326}
319327uint32_t SensorMesh::getDirectRetransmitDelay (const mesh::Packet* packet) {
328+ if (_radio->isAS923_1_JP ()) {
329+ uint32_t jitter_max = _radio->getEstAirtimeFor (MAX_TRANS_UNIT ) / RadioLibWrapper::JP_LBT_JITTER_DIVISOR ;
330+ return getRNG ()->nextInt (0 , jitter_max + 1 );
331+ }
320332 uint32_t t = (_radio->getEstAirtimeFor (packet->getPathByteLen () + packet->payload_len + 2 ) * _prefs.direct_tx_delay_factor );
321- return getRNG ()->nextInt (0 , 6 )*t ;
333+ return getRNG ()->nextInt (0 , 5 *t + 1 ) ;
322334}
323335int SensorMesh::getInterferenceThreshold () const {
324336 return _prefs.interference_threshold ;
0 commit comments