From 0fb5fab05acb57300d0d238471eed9047a21fd14 Mon Sep 17 00:00:00 2001 From: Vanya Sergeev Date: Thu, 18 Aug 2016 19:18:38 -0700 Subject: [PATCH] blocks/sources/hackrf: add warning on using sample rate below 8 MHz --- radio/blocks/sources/hackrf.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/radio/blocks/sources/hackrf.lua b/radio/blocks/sources/hackrf.lua index 7cfb53fda..65f6b4efc 100644 --- a/radio/blocks/sources/hackrf.lua +++ b/radio/blocks/sources/hackrf.lua @@ -145,6 +145,12 @@ function HackRFSource:initialize_hackrf() debug.printf("[HackRFSource] Board ID: %s\n", board_id) end + -- Check sample rate + if self.rate < 8e6 then + io.stderr:write(string.format("[HackRFSource] Warning: low sample rate (%u Hz).\n", self.rate)) + io.stderr:write("[HackRFSource] Using a sample rate under 8 MHz is not recommended!\n") + end + -- Set sample rate ret = libhackrf.hackrf_set_sample_rate(self.dev[0], self.rate) if ret ~= 0 then