srsLTE: fix TA calculation

master
Xavier Arteaga 5 years ago committed by Xavier Arteaga
parent 729986f259
commit 794f969e1a

@ -312,9 +312,13 @@ static void chest_ul_estimate(srslte_chest_ul_t* q,
} }
} }
// Average and store time aligment error // Calculate actual time alignment error in micro-seconds
if (isnormal(ta_err)) { if (isnormal(ta_err) && stride > 0) {
res->ta_us = roundf(ta_err / 15e-2f) / (10.0f * (float)stride); ta_err /= (float)stride; // Divide by the pilot spacing
ta_err /= 15e3f; // Convert from normalized frequency to seconds
ta_err *= 1e6f; // Convert to micro-seconds
ta_err = roundf(ta_err * 10.0f) / 10.0f; // Round to one tenth of micro-second
res->ta_us = ta_err;
} else { } else {
res->ta_us = 0.0f; res->ta_us = 0.0f;
} }

Loading…
Cancel
Save