Skip to content

Commit

Permalink
gr-uhd: fix first bursts transmitted by usrp_sink
Browse files Browse the repository at this point in the history
This commit is intended to fix issue #1944, where superfluous
call to UHD's 'send' function causes problems with beginning
of bursty transmission.
  • Loading branch information
Piotr Krysik authored and jdemel committed Aug 23, 2018
1 parent 8c8f166 commit 6f4a03a
Showing 1 changed file with 22 additions and 17 deletions.
39 changes: 22 additions & 17 deletions gr-uhd/lib/usrp_sink_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -690,28 +690,33 @@ namespace gr {
if (not _tx_stream)
_tx_stream = _dev->get_tx_stream(_stream_args);
#endif

_metadata.start_of_burst = true;
_metadata.end_of_burst = false;
// Bursty tx will need to send a tx_time to activate time spec
_metadata.has_time_spec = !_stream_now && pmt::is_null(_length_tag_key);
_nitems_to_send = 0;
if(_start_time_set) {
_start_time_set = false; //cleared for next run
_metadata.time_spec = _start_time;
}
else {
_metadata.time_spec = get_time_now() + ::uhd::time_spec_t(0.15);
}

if(pmt::is_null(_length_tag_key)){ //don't execute this part in burst mode
_metadata.start_of_burst = true;
_metadata.end_of_burst = false;
_metadata.has_time_spec = false;

if(!_stream_now){
_metadata.has_time_spec = true;
if(_start_time_set) {
_start_time_set = false; //cleared for next run
_metadata.time_spec = _start_time;
}
else {
_metadata.time_spec = get_time_now() + ::uhd::time_spec_t(0.15);
}
}

#ifdef GR_UHD_USE_STREAM_API
_tx_stream->send
(gr_vector_const_void_star(_nchan), 0, _metadata, 1.0);
_tx_stream->send
(gr_vector_const_void_star(_nchan), 0, _metadata, 1.0);
#else
_dev->get_device()->send
(gr_vector_const_void_star(_nchan), 0, _metadata,
*_type, ::uhd::device::SEND_MODE_ONE_PACKET, 1.0);
_dev->get_device()->send
(gr_vector_const_void_star(_nchan), 0, _metadata,
*_type, ::uhd::device::SEND_MODE_ONE_PACKET, 1.0);
#endif
}
return true;
}

Expand Down

0 comments on commit 6f4a03a

Please sign in to comment.