Radio: fix frame overlap at start-of-burst

master
Xavier Arteaga 4 years ago committed by Xavier Arteaga
parent a5f9ea5654
commit eba20b6367

@ -486,8 +486,6 @@ bool radio::tx_dev(const uint32_t& device_idx, rf_buffer_interface& buffer, cons
srslte_timestamp_add(&tx_time, 0, tx_adv_sec);
}
// Calculate transmission overlap/gap if it is not start of the burst
if (not is_start_of_burst) {
// Calculates transmission time overlap with previous transmission
srslte_timestamp_t ts_overlap = end_of_burst_time[device_idx];
srslte_timestamp_sub(&ts_overlap, tx_time.full_secs, tx_time.frac_secs);
@ -509,11 +507,19 @@ bool radio::tx_dev(const uint32_t& device_idx, rf_buffer_interface& buffer, cons
tx_time = end_of_burst_time[device_idx]; // Keeps same transmission time
nof_samples = nof_samples - past_nsamples; // Subtracts the number of trimmed samples
} else if (past_nsamples < 0) {
// Prints discarded samples
log_h->debug("Detected RF overlap of %.1f us. Discarding %d samples. Power=%+.1f dBfs\n",
srslte_timestamp_real(&ts_overlap) * 1.0e6,
past_nsamples,
srslte_convert_power_to_dB(srslte_vec_avg_power_cf(&buffer.get(0)[nof_samples], past_nsamples)));
} else if (past_nsamples < 0 and not is_start_of_burst) {
// if the gap is bigger than TX_MAX_GAP_ZEROS, stop burst
if (fabs(srslte_timestamp_real(&ts_overlap)) > tx_max_gap_zeros) {
log_h->info("Detected RF gap of %.1f us. Sending end-of-burst.\n", srslte_timestamp_real(&ts_overlap) * 1.0e6);
tx_end();
} else {
log_h->debug("Detected RF gap of %.1f us. Tx'ing zeroes.\n", srslte_timestamp_real(&ts_overlap) * 1.0e6);
// Otherwise, transmit zeros
uint32_t gap_nsamples = abs(past_nsamples);
while (gap_nsamples > 0) {
@ -540,7 +546,6 @@ bool radio::tx_dev(const uint32_t& device_idx, rf_buffer_interface& buffer, cons
}
}
}
}
// Save possible end of burst time
srslte_timestamp_copy(&end_of_burst_time[device_idx], &tx_time);

Loading…
Cancel
Save