Skip to content

Commit

Permalink
fftviewer: add option to run SISO channel B
Browse files Browse the repository at this point in the history
  • Loading branch information
rjonaitis committed Aug 12, 2024
1 parent ca30e9a commit 96019ad
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 29 deletions.
53 changes: 25 additions & 28 deletions GUI/fftviewer_wxgui/fftviewer_frFFTviewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ bool fftviewer_frFFTviewer::Initialize(SDRDevice* pDataPort)
if (channelCount <= 1)
{
cmbMode->Clear();
cmbMode->Append("SISO");
cmbMode->Append("SISO Ch.A");
cmbMode->SetSelection(0);

cmbChannelVisibility->Clear();
Expand All @@ -57,9 +57,8 @@ bool fftviewer_frFFTviewer::Initialize(SDRDevice* pDataPort)
}
else
{
constexpr uint8_t modeChoicesItemCount = 2;
const std::array<const wxString, modeChoicesItemCount> modeChoices{ "SISO", "MIMO" };
cmbMode->Set(modeChoicesItemCount, modeChoices.data());
const std::array<const wxString, 3> modeChoices{ "SISO Ch.A", "SISO Ch.B", "MIMO A&B" };
cmbMode->Set(modeChoices.size(), modeChoices.data());
cmbMode->SetSelection(0);
cmbMode->GetContainingSizer()->Layout(); // update the width of the box

Expand Down Expand Up @@ -233,17 +232,8 @@ void fftviewer_frFFTviewer::StartStreaming()
return;
if (mStreamRunning.load() == true)
return;
switch (cmbMode->GetSelection() % 2)
{
case 0: //SISO
cmbChannelVisibility->SetSelection(0);
cmbChannelVisibility->Disable();
threadProcessing = std::thread(StreamingLoop, this, fftSize, 1, 0);
break;
case 1: //MIMO
threadProcessing = std::thread(StreamingLoop, this, fftSize, 2, 0);
break;
}

threadProcessing = std::thread(StreamingLoop, this, fftSize, cmbMode->GetSelection() + 1, 0);

btnStartStop->SetLabel(_("STOP"));
mGUIupdater->Start(500);
Expand Down Expand Up @@ -378,9 +368,27 @@ void fftviewer_frFFTviewer::OnUpdatePlots(wxThreadEvent& event)
}

void fftviewer_frFFTviewer::StreamingLoop(
fftviewer_frFFTviewer* pthis, const unsigned int fftSize, const uint8_t channelsCount, const uint32_t format)
fftviewer_frFFTviewer* pthis, const unsigned int fftSize, const uint8_t channelEnablesMask, const uint32_t format)
{
const bool runTx = pthis->chkEnTx->GetValue();

StreamConfig config;
uint8_t channelsCount = 0;

for (uint8_t i = 0; i < 8; ++i)
{
if (channelEnablesMask & (1 << i))
{
config.channels.at(TRXDir::Rx).push_back(i);
if (runTx)
config.channels.at(TRXDir::Tx).push_back(i);
++channelsCount;
}
}

if (channelsCount == 0)
return;

int avgCount = pthis->spinAvgCount->GetValue();
auto wndFunction = static_cast<lime::FFT::WindowFunctionType>(pthis->windowFunctionID.load());
bool fftEnabled = true;
Expand Down Expand Up @@ -412,19 +420,8 @@ void fftviewer_frFFTviewer::StreamingLoop(

auto fmt = pthis->cmbFmt->GetSelection() == 1 ? DataFormat::I16 : DataFormat::I12;

StreamConfig config;

config.format = DataFormat::F32;
config.linkFormat = fmt;
for (uint8_t i = 0; i < channelsCount; ++i)
{
config.channels.at(TRXDir::Rx).push_back(i);
if (runTx)
{
config.channels.at(TRXDir::Tx).push_back(i);
}
}

const uint8_t chipIndex = pthis->lmsIndex;

try
Expand Down Expand Up @@ -602,7 +599,7 @@ void fftviewer_frFFTviewer::OnStreamChange(wxCommandEvent& event)
cmbChannelVisibility->Clear();
cmbChannelVisibility->Append(_T("A"));
cmbChannelVisibility->Append(_T("B"));
if (cmbMode->GetSelection() % 2 == 1)
if (cmbMode->GetSelection() == 2)
cmbChannelVisibility->Append(_T("A&B"));
else if (tmp > 1)
tmp = 0;
Expand Down
2 changes: 1 addition & 1 deletion GUI/fftviewer_wxgui/fftviewer_frFFTviewer.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class fftviewer_frFFTviewer : public frFFTviewer
void OnWindowFunctionChange(wxCommandEvent& event) override;
bool Show(bool show) override;
static void StreamingLoop(
fftviewer_frFFTviewer* pthis, const unsigned int fftSize, const uint8_t channelsCount, const uint32_t format);
fftviewer_frFFTviewer* pthis, const unsigned int fftSize, const uint8_t channelEnablesMask, const uint32_t format);

void OnUpdateStats(wxTimerEvent& event);
void OnUpdatePlots(wxThreadEvent& event);
Expand Down

0 comments on commit 96019ad

Please sign in to comment.