diff options
author | Josh Blum <josh@joshknows.com> | 2012-08-23 11:40:42 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2012-08-29 15:14:11 -0700 |
commit | 05a06254a7f0149425bdda0e5544507bd35a671b (patch) | |
tree | b6c636db745d9fdf3de35ef91acbc61b4f5b724b /host/lib | |
parent | 584b7ae26c4e61688c06043a0587ca50ac83b1dc (diff) | |
download | uhd-05a06254a7f0149425bdda0e5544507bd35a671b.tar.gz uhd-05a06254a7f0149425bdda0e5544507bd35a671b.tar.bz2 uhd-05a06254a7f0149425bdda0e5544507bd35a671b.zip |
cal: dont interpolate if freq is the same +/- epsilon
Diffstat (limited to 'host/lib')
-rw-r--r-- | host/lib/usrp/common/apply_corrections.cpp | 12 |
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; |