From 957ba605dce4504acd8bb3d30265af1d7a3144f5 Mon Sep 17 00:00:00 2001
From: Sergey Musikhin <musihin_sergei@mail.ru>
Date: Sun, 13 Jun 2021 11:38:24 +0000
Subject: [PATCH] smb

---
 grc/gen_bladerf_blocks.py     |  8 ++++++++
 lib/bladerf/bladerf_common.cc | 13 ++++++++-----
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/grc/gen_bladerf_blocks.py b/grc/gen_bladerf_blocks.py
index e9f5957..f2cdb8c 100644
--- a/grc/gen_bladerf_blocks.py
+++ b/grc/gen_bladerf_blocks.py
@@ -149,6 +149,13 @@ parameters:
   option_labels: ['Disabled', 'Bypassed'] 
   hide: part
   
+- id: smb
+  label: 'SMB frequency'
+  category: x40/x115
+  dtype: real
+  default: 0
+  hide: part  
+  
 - id: dc_calibration
   label: 'DC calibration'
   category: x40/x115
@@ -215,6 +222,7 @@ templates:
              + ",tamer=" + '${'$'}{tamer}'
              + ",sampling=" + '${'$'}{sampling}'
              + ",lpf_mode="+'${'$'}{lpf_mode}'
+             + ",smb="+str(int(${'$'}{smb}))
              + ",dc_calibration="+'${'$'}{dc_calibration}'
              + ",trigger0="+'${'$'}{trigger0}'
              + ",trigger_role0="+'${'$'}{trigger_role0}'
diff --git a/lib/bladerf/bladerf_common.cc b/lib/bladerf/bladerf_common.cc
index cfad5ee..42c2c22 100644
--- a/lib/bladerf/bladerf_common.cc
+++ b/lib/bladerf/bladerf_common.cc
@@ -362,11 +362,7 @@ void bladerf_common::init(dict_t const &dict, bladerf_direction direction)
 
 
 
-  if (dict.count("smb")) {
-    set_smb_frequency(boost::lexical_cast<double>(_get(dict, "smb")));
-    BLADERF_INFO(boost::str(boost::format("SMB frequency set to %f Hz")
-                  % get_smb_frequency()));
-  }
+
 
   /* Initialize buffer and sample configuration */
   if (dict.count("buffers")) {
@@ -462,6 +458,13 @@ void bladerf_common::init_bladerf1(const dict_t &dict, bladerf_direction directi
                 ? BLADERF_LPF_BYPASSED : BLADERF_LPF_DISABLED;
         set_lpf_mode(ch, mode);
     }
+    if (dict.count("smb")) {
+        set_smb_frequency(boost::lexical_cast<double>(_get(dict, "smb")));
+        BLADERF_INFO(boost::str(boost::format("SMB frequency set to %f Hz")
+                      % get_smb_frequency()));
+    }
+
+
 
 
 }
-- 
GitLab