From 1f5dc898e902fdec5afb2d60f3083320e50e34f8 Mon Sep 17 00:00:00 2001 From: karel <5636152+karel@users.noreply.github.com> Date: Mon, 22 Feb 2021 18:03:03 +0200 Subject: gr-uhd: add start time capability to cpp template also reorder USRP initialization to match Python template Signed-off-by: karel <5636152+karel@users.noreply.github.com> --- gr-uhd/grc/gen_uhd_usrp_blocks.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'gr-uhd/grc/gen_uhd_usrp_blocks.py') diff --git a/gr-uhd/grc/gen_uhd_usrp_blocks.py b/gr-uhd/grc/gen_uhd_usrp_blocks.py index c2685d6f2e..d9a7d6e478 100644 --- a/gr-uhd/grc/gen_uhd_usrp_blocks.py +++ b/gr-uhd/grc/gen_uhd_usrp_blocks.py @@ -283,6 +283,15 @@ cpp_templates: ${'%'} endif ${'%'} endif % endfor + this->${'$'}{id}->set_samp_rate(${'$'}{samp_rate}); + ${'%'} if sync == 'sync': + this->${'$'}{id}->set_time_unknown_pps(::uhd::time_spec_t()); + ${'%'} elif sync == 'pc_clock': + this->${'$'}{id}->set_time_now(::uhd::time_spec_t(time(NULL)), ::uhd::usrp::multi_usrp::ALL_MBOARDS); + ${'%'} else: + // No synchronization enforced. + ${'%'} endif + % for n in range(max_nchan): ${'%'} if context.get('nchan')() > ${n}: this->${'$'}{id}->set_center_freq(${'$'}{${'center_freq' + str(n)}}, ${n}); @@ -325,13 +334,8 @@ cpp_templates: ${'%'} if clock_rate(): this->${'$'}{id}->set_clock_rate(${'$'}{clock_rate}, ::uhd::usrp::multi_usrp::ALL_MBOARDS); ${'%'} endif - this->${'$'}{id}->set_samp_rate(${'$'}{samp_rate}); - ${'%'} if sync == 'sync': - this->${'$'}{id}->set_time_unknown_pps(::uhd::time_spec_t()); - ${'%'} elif sync == 'pc_clock': - this->${'$'}{id}->set_time_now(::uhd::time_spec_t(time(NULL)), ::uhd::usrp::multi_usrp::ALL_MBOARDS); - ${'%'} else: - // No synchronization enforced. + ${'%'} if start_time() >= 0.0: + this->${'$'}{id}->set_start_time(::uhd::time_spec_t(${'$'}{float(start_time)})); ${'%'} endif link: ['gnuradio-uhd uhd'] callbacks: -- cgit v1.2.3