Skip to content

Commit

Permalink
Fix deleted thread acces, and change SDR start time
Browse files Browse the repository at this point in the history
  • Loading branch information
jsroldan committed Mar 13, 2023
1 parent f3a28b8 commit bd64865
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/SdrReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,14 +217,15 @@ void SdrReader::start() {
for (auto ch = 0; ch < _rx_channels; ch++) {
channels[ch] = ch;
}
sdr->setHardwareTime(0); // Set SDR timestamp to zero.
_stream = sdr->setupStream( SOAPY_SDR_RX, SOAPY_SDR_CF32, channels, _device_args);
if( _stream == nullptr)
{
spdlog::error("Failed to set up RX stream");
SoapySDR::Device::unmake( sdr );
return ;
}
sdr->activateStream( (SoapySDR::Stream*)_stream, 0, 0, 0);
sdr->activateStream( (SoapySDR::Stream*)_stream, SOAPY_SDR_HAS_TIME, 4000000, 0); // Delayed start of the SDR reception, to avoid overfloas at the beggining.
}
_running = true;

Expand All @@ -245,13 +246,13 @@ void SdrReader::start() {
void SdrReader::stop() {
_running = false;

_readerThread.join();
if (_sdr != nullptr) {
auto sdr = (SoapySDR::Device*)_sdr;
sdr->deactivateStream((SoapySDR::Stream*)_stream, 0, 0);
sdr->closeStream((SoapySDR::Stream*)_stream);
}

_readerThread.join();
clear_buffer();
}

Expand Down

0 comments on commit bd64865

Please sign in to comment.