|
|
|
@ -313,12 +313,24 @@ int SensorMesh::calcRxDelay(float score, uint32_t air_time) const { |
|
|
|
} |
|
|
|
|
|
|
|
uint32_t SensorMesh::getRetransmitDelay(const mesh::Packet* packet) { |
|
|
|
if (_radio->isAS923_1_JP()) { |
|
|
|
// JP LBT: suppress txdelay to jitter-scale to avoid adding unnecessary
|
|
|
|
// latency on top of LBT backoff. A window equal to jitter_max gives
|
|
|
|
// ~33% collision reduction vs zero, scales naturally with airtime as
|
|
|
|
// CR changes, and keeps average added delay to ~56ms at SF12/BW125.
|
|
|
|
uint32_t jitter_max = _radio->getEstAirtimeFor(MAX_TRANS_UNIT) / RadioLibWrapper::JP_LBT_JITTER_DIVISOR; |
|
|
|
return getRNG()->nextInt(0, jitter_max + 1); |
|
|
|
} |
|
|
|
uint32_t t = (_radio->getEstAirtimeFor(packet->getPathByteLen() + packet->payload_len + 2) * _prefs.tx_delay_factor); |
|
|
|
return getRNG()->nextInt(0, 6)*t; |
|
|
|
return getRNG()->nextInt(0, 5*t + 1); |
|
|
|
} |
|
|
|
uint32_t SensorMesh::getDirectRetransmitDelay(const mesh::Packet* packet) { |
|
|
|
if (_radio->isAS923_1_JP()) { |
|
|
|
uint32_t jitter_max = _radio->getEstAirtimeFor(MAX_TRANS_UNIT) / RadioLibWrapper::JP_LBT_JITTER_DIVISOR; |
|
|
|
return getRNG()->nextInt(0, jitter_max + 1); |
|
|
|
} |
|
|
|
uint32_t t = (_radio->getEstAirtimeFor(packet->getPathByteLen() + packet->payload_len + 2) * _prefs.direct_tx_delay_factor); |
|
|
|
return getRNG()->nextInt(0, 6)*t; |
|
|
|
return getRNG()->nextInt(0, 5*t + 1); |
|
|
|
} |
|
|
|
int SensorMesh::getInterferenceThreshold() const { |
|
|
|
return _prefs.interference_threshold; |
|
|
|
|