Handle retransmit timeouts

This commit is contained in:
Thomas Kolb 2024-07-20 01:04:03 +02:00
parent fe684f7a1d
commit 3068db1d50

View file

@ -227,9 +227,17 @@ int main(int argc, char **argv)
size_t total_samples = 0;
double next_stats_print_time = old + 0.5;
double retransmit_time = 0.0;
while(m_running) {
double now = get_hires_time();
if(retransmit_time != 0.0 && now >= retransmit_time) {
LOG(LVL_INFO, "Retransmit triggered.");
retransmit_time = 0.0;
layer2_tx_restart(&l2tx);
}
// fill the TX queue from the TUN device
layer2_tx_fill_packet_queue(&l2tx);
@ -285,6 +293,8 @@ int main(int argc, char **argv)
// ensure that the buffer is full before TX is turned on to avoid transmitting empty buffers
RESULT_CHECK(transmit(&sdr, whole_burst, burst_len));
retransmit_time = get_hires_time() + 4.0;
if(!on_air) {
LOG(LVL_INFO, "RX -> TX");
RESULT_CHECK(sdr_stop_rx(&sdr));
@ -296,7 +306,7 @@ int main(int argc, char **argv)
}
on_air = true;
} else if(on_air) { // ret == 0
} else if(on_air) { // TX on, but no more bursts to send
LOG(LVL_INFO, "TX -> RX");
RESULT_CHECK(sdr_flush_tx_buffer(&sdr));
RESULT_CHECK(layer1_rx_reset(&rx));