Randomize retransmit time

This commit is contained in:
Thomas Kolb 2024-08-09 21:45:10 +02:00
parent d2ef6d9741
commit 2ddb8aa18c

View file

@ -179,6 +179,8 @@ int main(int argc, char **argv)
bool on_air = true; bool on_air = true;
srand((int)(get_hires_time() * 1e6));
// ** Initialize ** // ** Initialize **
char devname[IFNAMSIZ] = "hamnet70"; char devname[IFNAMSIZ] = "hamnet70";
@ -296,8 +298,6 @@ int main(int argc, char **argv)
// ensure that the buffer is full before TX is turned on to avoid transmitting empty buffers // ensure that the buffer is full before TX is turned on to avoid transmitting empty buffers
RESULT_CHECK(transmit(&sdr, whole_burst, burst_len)); RESULT_CHECK(transmit(&sdr, whole_burst, burst_len));
retransmit_time = get_hires_time() + 4.0;
if(!on_air) { if(!on_air) {
LOG(LVL_INFO, "RX -> TX"); LOG(LVL_INFO, "RX -> TX");
RESULT_CHECK(sdr_stop_rx(&sdr)); RESULT_CHECK(sdr_stop_rx(&sdr));
@ -318,6 +318,8 @@ int main(int argc, char **argv)
RESULT_CHECK(sdr_start_rx(&sdr)); RESULT_CHECK(sdr_start_rx(&sdr));
on_air = false; on_air = false;
retransmit_time = get_hires_time() + 1.0 + 1.0 * rand() / RAND_MAX;
block_tx_for(TX_SWITCH_BACKOFF_AFTER_RX_ON); block_tx_for(TX_SWITCH_BACKOFF_AFTER_RX_ON);
} }
} }