summaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/common
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2012-08-23 11:40:42 -0700
committerJosh Blum <josh@joshknows.com>2012-08-29 15:14:11 -0700
commit05a06254a7f0149425bdda0e5544507bd35a671b (patch)
treeb6c636db745d9fdf3de35ef91acbc61b4f5b724b /host/lib/usrp/common
parent584b7ae26c4e61688c06043a0587ca50ac83b1dc (diff)
downloaduhd-05a06254a7f0149425bdda0e5544507bd35a671b.tar.gz
uhd-05a06254a7f0149425bdda0e5544507bd35a671b.tar.bz2
uhd-05a06254a7f0149425bdda0e5544507bd35a671b.zip
cal: dont interpolate if freq is the same +/- epsilon
Diffstat (limited to 'host/lib/usrp/common')
-rw-r--r--host/lib/usrp/common/apply_corrections.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/host/lib/usrp/common/apply_corrections.cpp b/host/lib/usrp/common/apply_corrections.cpp
index b889266f2..3d33e7d11 100644
--- a/host/lib/usrp/common/apply_corrections.cpp
+++ b/host/lib/usrp/common/apply_corrections.cpp
@@ -54,6 +54,12 @@ static bool fe_cal_comp(fe_cal_t a, fe_cal_t b){
static uhd::dict<std::string, std::vector<fe_cal_t> > fe_cal_cache;
+static bool is_same_freq(const double f1, const double f2)
+{
+ const double epsilon = 0.1;
+ return ((f1 - epsilon) < f2 and (f1 + epsilon) > f2);
+}
+
static std::complex<double> get_fe_correction(
const std::string &key, const double lo_freq
){
@@ -64,6 +70,12 @@ static std::complex<double> get_fe_correction(
size_t lo_index = 0;
size_t hi_index = datas.size()-1;
for (size_t i = 0; i < datas.size(); i++){
+ if (is_same_freq(datas[i].lo_freq, lo_freq))
+ {
+ hi_index = i;
+ lo_index = i;
+ break;
+ }
if (datas[i].lo_freq > lo_freq){
hi_index = i;
break;