From 05ea9181715b56e3eec89ce22bd4b53a2d1d499b Mon Sep 17 00:00:00 2001 From: Nicholas Corgan <nick.corgan@ettus.com> Date: Fri, 12 Feb 2016 09:12:23 -0800 Subject: blocks: fixed signed vs. unsigned comparison --- gr-blocks/lib/min_XX_impl.cc.t | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gr-blocks/lib/min_XX_impl.cc.t b/gr-blocks/lib/min_XX_impl.cc.t index d1cea61424..0f7059f7cd 100644 --- a/gr-blocks/lib/min_XX_impl.cc.t +++ b/gr-blocks/lib/min_XX_impl.cc.t @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2014,2015 Free Software Foundation, Inc. + * Copyright 2014,2015,2016 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -77,7 +77,7 @@ namespace gr { } else // vector mode output - for(int i = 0; i < noutput_items * d_vlen_out; i++) { + for(size_t i = 0; i < noutput_items * d_vlen_out; i++) { @I_TYPE@ min = ((@I_TYPE@ *)input_items[0])[i]; for(int k = 1; k < ninputs; k++) { -- cgit v1.2.3 From 62e8f2383b340c7fae4addeaa8d44330da95a6ea Mon Sep 17 00:00:00 2001 From: Martin Braun <martin.braun@ettus.com> Date: Fri, 12 Feb 2016 10:29:16 -0800 Subject: uhd: Loosen requirements for multi-chan ops to have timed command capability --- gr-uhd/apps/uhd_app.py | 22 ++++++++++++++++------ gr-uhd/apps/uhd_rx_cfile | 11 ++++++++--- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/gr-uhd/apps/uhd_app.py b/gr-uhd/apps/uhd_app.py index bb4b9a78af..59bebe24ec 100644 --- a/gr-uhd/apps/uhd_app.py +++ b/gr-uhd/apps/uhd_app.py @@ -167,12 +167,17 @@ class UHDApp(object): treq = uhd.tune_request(args.freq) self.has_lo_sensor = 'lo_locked' in self.usrp.get_sensor_names() # Make sure tuning is synched: + command_time_set = False if len(self.channels) > 1: if args.sync == 'pps': self.usrp.set_time_unknown_pps(uhd.time_spec()) cmd_time = self.usrp.get_time_now() + uhd.time_spec(COMMAND_DELAY) - for mb_idx in xrange(self.usrp.get_num_mboards()): - self.usrp.set_command_time(cmd_time, mb_idx) + try: + for mb_idx in xrange(self.usrp.get_num_mboards()): + self.usrp.set_command_time(cmd_time, mb_idx) + command_time_set = True + except RuntimeError: + sys.stderr.write('[{prefix}] [WARNING] Failed to set command times.\n'.format(prefix=self.prefix)) for chan in self.channels: self.tr = self.usrp.set_center_freq(treq, chan) if self.tr == None: @@ -180,7 +185,7 @@ class UHDApp(object): prefix=self.prefix, chan=chan )) exit(1) - if len(self.channels) > 1: + if command_time_set: for mb_idx in xrange(self.usrp.get_num_mboards()): self.usrp.clear_command_time(mb_idx) self.vprint("Syncing channels...".format(prefix=self.prefix)) @@ -223,10 +228,15 @@ class UHDApp(object): else: treq = uhd.tune_request(freq) # Make sure tuning is synched: + command_time_set = False if len(self.channels) > 1 and not skip_sync: cmd_time = self.usrp.get_time_now() + uhd.time_spec(COMMAND_DELAY) - for mb_idx in xrange(self.usrp.get_num_mboards()): - self.usrp.set_command_time(cmd_time, mb_idx) + try: + for mb_idx in xrange(self.usrp.get_num_mboards()): + self.usrp.set_command_time(cmd_time, mb_idx) + command_time_set = True + except RuntimeError: + sys.stderr.write('[{prefix}] [WARNING] Failed to set command times.\n'.format(prefix=self.prefix)) for chan in self.channels: self.tr = self.usrp.set_center_freq(treq, chan) if self.tr == None: @@ -234,7 +244,7 @@ class UHDApp(object): prefix=self.prefix, chan=chan )) exit(1) - if len(self.channels) > 1 and not skip_sync: + if command_time_set: for mb_idx in xrange(self.usrp.get_num_mboards()): self.usrp.clear_command_time(mb_idx) self.vprint("Syncing channels...".format(prefix=self.prefix)) diff --git a/gr-uhd/apps/uhd_rx_cfile b/gr-uhd/apps/uhd_rx_cfile index 80bbc8766c..672e9641e4 100755 --- a/gr-uhd/apps/uhd_rx_cfile +++ b/gr-uhd/apps/uhd_rx_cfile @@ -115,18 +115,23 @@ class rx_cfile_block(gr.top_block): else: treq = uhd.tune_request(options.freq) # Make sure tuning is synched: + command_time_set = False if len(self.channels) > 1: if options.sync == 'pps': self._u.set_time_unknown_pps(uhd.time_spec()) cmd_time = self._u.get_time_now() + uhd.time_spec(COMMAND_DELAY) - for mb_idx in xrange(self._u.get_num_mboards()): - self._u.set_command_time(cmd_time, mb_idx) + try: + for mb_idx in xrange(self._u.get_num_mboards()): + self._u.set_command_time(cmd_time, mb_idx) + command_time_set = True + except RuntimeError: + sys.stderr.write('[UHD_RX] [WARNING] Failed to set command times.\n') for chan in self.channels: tr = self._u.set_center_freq(treq, chan) if tr == None: sys.stderr.write('[UHD_RX] [ERROR] Failed to set center frequency on channel {chan}\n'.format(chan=chan)) exit(1) - if len(self.channels) > 1: + if command_time_set: for mb_idx in xrange(self._u.get_num_mboards()): self._u.clear_command_time(mb_idx) print("[UHD_RX] Syncing channels...") -- cgit v1.2.3 From eec2270fc1d9a5bde7f0a40e44b3a7556b58629a Mon Sep 17 00:00:00 2001 From: Tom Rondeau <tom@trondeau.com> Date: Fri, 15 Jan 2016 16:57:18 -0500 Subject: analog: add ControlPort interfaces to frequency_modulator block. Change cmake file to allow ControlPort even for static library builds. --- gr-analog/lib/CMakeLists.txt | 11 ----------- gr-analog/lib/frequency_modulator_fc_impl.cc | 22 ++++++++++++++++++++++ gr-analog/lib/frequency_modulator_fc_impl.h | 2 ++ 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/gr-analog/lib/CMakeLists.txt b/gr-analog/lib/CMakeLists.txt index 918f894abe..a75d70337b 100644 --- a/gr-analog/lib/CMakeLists.txt +++ b/gr-analog/lib/CMakeLists.txt @@ -110,17 +110,6 @@ GR_LIBRARY_FOO(gnuradio-analog RUNTIME_COMPONENT "analog_runtime" DEVEL_COMPONEN add_dependencies(gnuradio-analog analog_generated_includes analog_generated_swigs gnuradio-filter) if(ENABLE_STATIC_LIBS) - if(ENABLE_GR_CTRLPORT) - # Remove GR_CTRLPORT set this target's definitions. - # Makes sure we don't try to use ControlPort stuff in source files - GET_DIRECTORY_PROPERTY(STATIC_DEFS COMPILE_DEFINITIONS) - list(REMOVE_ITEM STATIC_DEFS "GR_CTRLPORT") - SET_PROPERTY(DIRECTORY PROPERTY COMPILE_DEFINITIONS "${STATIC_DEFS}") - - # readd it to the target since we removed it from the directory-wide list. - SET_PROPERTY(TARGET gnuradio-analog APPEND PROPERTY COMPILE_DEFINITIONS "GR_CTRLPORT") - endif(ENABLE_GR_CTRLPORT) - add_library(gnuradio-analog_static STATIC ${analog_sources}) add_dependencies(gnuradio-analog_static diff --git a/gr-analog/lib/frequency_modulator_fc_impl.cc b/gr-analog/lib/frequency_modulator_fc_impl.cc index 812eb8bf0b..56fa0f7c17 100644 --- a/gr-analog/lib/frequency_modulator_fc_impl.cc +++ b/gr-analog/lib/frequency_modulator_fc_impl.cc @@ -76,5 +76,27 @@ namespace gr { return noutput_items; } + void + frequency_modulator_fc_impl::setup_rpc() + { +#ifdef GR_CTRLPORT + add_rpc_variable( + rpcbasic_sptr(new rpcbasic_register_get<frequency_modulator_fc, float>( + alias(), "sensitivity", + &frequency_modulator_fc::sensitivity, + pmt::mp(-1024.0f), pmt::mp(1024.0f), pmt::mp(0.0f), + "", "Sensitivity", RPC_PRIVLVL_MIN, + DISPTIME | DISPOPTSTRIP))); + + add_rpc_variable( + rpcbasic_sptr(new rpcbasic_register_set<frequency_modulator_fc, float>( + alias(), "sensitivity", + &frequency_modulator_fc::set_sensitivity, + pmt::mp(-1024.0f), pmt::mp(1024.0f), pmt::mp(0.0f), + "", "sensitivity", + RPC_PRIVLVL_MIN, DISPNULL))); +#endif /* GR_CTRLPORT */ + + } } /* namespace analog */ } /* namespace gr */ diff --git a/gr-analog/lib/frequency_modulator_fc_impl.h b/gr-analog/lib/frequency_modulator_fc_impl.h index 9f5310ce97..9f595d1ddb 100644 --- a/gr-analog/lib/frequency_modulator_fc_impl.h +++ b/gr-analog/lib/frequency_modulator_fc_impl.h @@ -41,6 +41,8 @@ namespace gr { void set_sensitivity(float sens) { d_sensitivity = sens; } float sensitivity() const { return d_sensitivity; } + void setup_rpc(); + int work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); -- cgit v1.2.3