1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-16 05:11:49 -05:00

MIMO: test MI: select stream to be displayed on main sperctrum

This commit is contained in:
f4exb 2019-05-28 12:09:08 +02:00
parent bb8366bfde
commit a0f16a1db0
5 changed files with 159 additions and 118 deletions

View File

@ -434,7 +434,7 @@ bool TestMI::applySettings(const TestMISettings& settings, bool force)
DSPSignalNotification *notif = new DSPSignalNotification(sampleRate, settings.m_streams[istream].m_centerFrequency); DSPSignalNotification *notif = new DSPSignalNotification(sampleRate, settings.m_streams[istream].m_centerFrequency);
m_fileSinks[istream]->handleMessage(*notif); // forward to file sink m_fileSinks[istream]->handleMessage(*notif); // forward to file sink
DSPDeviceMIMOEngine::SignalNotification *engineNotif = new DSPDeviceMIMOEngine::SignalNotification( DSPDeviceMIMOEngine::SignalNotification *engineNotif = new DSPDeviceMIMOEngine::SignalNotification(
sampleRate, settings.m_streams[istream].m_centerFrequency, true, 0); sampleRate, settings.m_streams[istream].m_centerFrequency, true, istream);
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(engineNotif); m_deviceAPI->getDeviceEngineInputMessageQueue()->push(engineNotif);
} }

View File

@ -53,8 +53,14 @@ TestMIGui::TestMIGui(DeviceUISet *deviceUISet, QWidget* parent) :
qDebug("TestMIGui::TestMIGui"); qDebug("TestMIGui::TestMIGui");
m_sampleMIMO = m_deviceUISet->m_deviceAPI->getSampleMIMO(); m_sampleMIMO = m_deviceUISet->m_deviceAPI->getSampleMIMO();
m_streamIndex = 0; m_streamIndex = 0;
m_deviceCenterFrequencies.push_back(m_settings.m_streams[0].m_centerFrequency);
m_deviceCenterFrequencies.push_back(m_settings.m_streams[1].m_centerFrequency);
m_deviceSampleRates.push_back(m_settings.m_streams[0].m_sampleRate / (1<<m_settings.m_streams[0].m_log2Decim));
m_deviceSampleRates.push_back(m_settings.m_streams[1].m_sampleRate / (1<<m_settings.m_streams[1].m_log2Decim));
ui->setupUi(this); ui->setupUi(this);
ui->spectrumSource->addItem("0");
ui->spectrumSource->addItem("1");
ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold)); ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
ui->centerFrequency->setValueRange(7, 0, 9999999); ui->centerFrequency->setValueRange(7, 0, 9999999);
ui->sampleRate->setColorMapper(ColorMapper(ColorMapper::GrayGreenYellow)); ui->sampleRate->setColorMapper(ColorMapper(ColorMapper::GrayGreenYellow));
@ -146,9 +152,17 @@ void TestMIGui::on_streamIndex_currentIndexChanged(int index)
{ {
m_streamIndex = index; m_streamIndex = index;
updateFileRecordStatus(); updateFileRecordStatus();
updateSampleRateAndFrequency();
displaySettings(); displaySettings();
} }
void TestMIGui::on_spectrumSource_currentIndexChanged(int index)
{
m_spectrumStreamIndex = index;
m_deviceUISet->m_deviceAPI->setSpectrumSinkInput(true, m_spectrumStreamIndex);
updateSampleRateAndFrequency();
}
void TestMIGui::on_centerFrequency_changed(quint64 value) void TestMIGui::on_centerFrequency_changed(quint64 value)
{ {
m_settings.m_streams[m_streamIndex].m_centerFrequency = value * 1000; m_settings.m_streams[m_streamIndex].m_centerFrequency = value * 1000;
@ -511,10 +525,14 @@ void TestMIGui::handleInputMessages()
if (DSPDeviceMIMOEngine::SignalNotification::match(*message)) if (DSPDeviceMIMOEngine::SignalNotification::match(*message))
{ {
DSPDeviceMIMOEngine::SignalNotification* notif = (DSPDeviceMIMOEngine::SignalNotification*) message; DSPDeviceMIMOEngine::SignalNotification* notif = (DSPDeviceMIMOEngine::SignalNotification*) message;
m_deviceSampleRate = notif->getSampleRate(); int istream = notif->getIndex();
m_deviceCenterFrequency = notif->getCenterFrequency(); bool sourceOrSink = notif->getSourceOrSink();
m_deviceSampleRates[istream] = notif->getSampleRate();
m_deviceCenterFrequencies[istream] = notif->getCenterFrequency();
// Do not consider multiple sources at this time // Do not consider multiple sources at this time
qDebug("TestMIGui::handleInputMessages: DSPDeviceMIMOEngine::SignalNotification: SampleRate:%d, CenterFrequency:%llu", qDebug("TestMIGui::handleInputMessages: DSPDeviceMIMOEngine::SignalNotification: %s stream: %d SampleRate:%d, CenterFrequency:%llu",
sourceOrSink ? "source" : "sink",
istream,
notif->getSampleRate(), notif->getSampleRate(),
notif->getCenterFrequency()); notif->getCenterFrequency());
updateSampleRateAndFrequency(); updateSampleRateAndFrequency();
@ -533,9 +551,9 @@ void TestMIGui::handleInputMessages()
void TestMIGui::updateSampleRateAndFrequency() void TestMIGui::updateSampleRateAndFrequency()
{ {
m_deviceUISet->getSpectrum()->setSampleRate(m_deviceSampleRate); m_deviceUISet->getSpectrum()->setSampleRate(m_deviceSampleRates[m_spectrumStreamIndex]);
m_deviceUISet->getSpectrum()->setCenterFrequency(m_deviceCenterFrequency); m_deviceUISet->getSpectrum()->setCenterFrequency(m_deviceCenterFrequencies[m_spectrumStreamIndex]);
ui->deviceRateText->setText(tr("%1k").arg((float)m_deviceSampleRate / 1000)); ui->deviceRateText->setText(tr("%1k").arg((float) m_deviceSampleRates[m_streamIndex] / 1000));
} }
void TestMIGui::openDeviceSettingsDialog(const QPoint& p) void TestMIGui::openDeviceSettingsDialog(const QPoint& p)

View File

@ -58,14 +58,15 @@ private:
DeviceUISet* m_deviceUISet; DeviceUISet* m_deviceUISet;
TestMISettings m_settings; TestMISettings m_settings;
int m_streamIndex; //!< Current stream index being dealt with int m_streamIndex; //!< Current stream index being dealt with
int m_spectrumStreamIndex; //!< Index of the stream displayed on main spectrum
QTimer m_updateTimer; QTimer m_updateTimer;
QTimer m_statusTimer; QTimer m_statusTimer;
bool m_doApplySettings; bool m_doApplySettings;
bool m_forceSettings; bool m_forceSettings;
DeviceSampleMIMO* m_sampleMIMO; DeviceSampleMIMO* m_sampleMIMO;
std::size_t m_tickCount; std::size_t m_tickCount;
int m_deviceSampleRate; std::vector<int> m_deviceSampleRates;
quint64 m_deviceCenterFrequency; //!< Center frequency in device std::vector<quint64> m_deviceCenterFrequencies; //!< Center frequency in device
int m_lastEngineState; int m_lastEngineState;
MessageQueue m_inputMessageQueue; MessageQueue m_inputMessageQueue;
@ -83,6 +84,7 @@ private slots:
void handleInputMessages(); void handleInputMessages();
void on_startStop_toggled(bool checked); void on_startStop_toggled(bool checked);
void on_streamIndex_currentIndexChanged(int index); void on_streamIndex_currentIndexChanged(int index);
void on_spectrumSource_currentIndexChanged(int index);
void on_centerFrequency_changed(quint64 value); void on_centerFrequency_changed(quint64 value);
void on_autoCorr_currentIndexChanged(int index); void on_autoCorr_currentIndexChanged(int index);
void on_frequencyShift_changed(qint64 value); void on_frequencyShift_changed(qint64 value);

View File

@ -50,6 +50,80 @@
<property name="bottomMargin"> <property name="bottomMargin">
<number>2</number> <number>2</number>
</property> </property>
<item>
<layout class="QHBoxLayout" name="streamLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Stream</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="streamIndex">
<property name="maximumSize">
<size>
<width>40</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Stream index</string>
</property>
<item>
<property name="text">
<string>0</string>
</property>
</item>
<item>
<property name="text">
<string>1</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QLabel" name="spectrumSourceLabel">
<property name="text">
<string>Spectrum</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="spectrumSource">
<property name="maximumSize">
<size>
<width>60</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Select stream for main spectrum source</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_freq"> <layout class="QHBoxLayout" name="horizontalLayout_freq">
<property name="topMargin"> <property name="topMargin">
@ -181,114 +255,6 @@
</item> </item>
</layout> </layout>
</item> </item>
<item>
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="channelLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Stream</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="streamIndex">
<property name="maximumSize">
<size>
<width>40</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Stream index</string>
</property>
<item>
<property name="text">
<string>0</string>
</property>
</item>
<item>
<property name="text">
<string>1</string>
</property>
</item>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="samplerateLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>16</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>SR</string>
</property>
</widget>
</item>
<item>
<widget class="ValueDial" name="sampleRate" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>32</width>
<height>16</height>
</size>
</property>
<property name="font">
<font>
<family>Liberation Mono</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="toolTip">
<string>Generator sample rate (S/s)</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="sampleRateUnit">
<property name="text">
<string>S/s</string>
</property>
</widget>
</item>
</layout>
</item>
<item> <item>
<layout class="QHBoxLayout" name="autoCorrectionsLayout"> <layout class="QHBoxLayout" name="autoCorrectionsLayout">
<item> <item>
@ -481,6 +447,60 @@
<property name="bottomMargin"> <property name="bottomMargin">
<number>2</number> <number>2</number>
</property> </property>
<item>
<widget class="QLabel" name="samplerateLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>16</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>SR</string>
</property>
</widget>
</item>
<item>
<widget class="ValueDial" name="sampleRate" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>32</width>
<height>16</height>
</size>
</property>
<property name="font">
<font>
<family>Liberation Mono</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="toolTip">
<string>Generator sample rate (S/s)</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="sampleRateUnit">
<property name="text">
<string>S/s</string>
</property>
</widget>
</item>
<item> <item>
<spacer name="horizontalSpacer_5"> <spacer name="horizontalSpacer_5">
<property name="orientation"> <property name="orientation">

View File

@ -948,7 +948,6 @@ void DSPDeviceMIMOEngine::handleInputMessages()
<< " sampleRate: " << sampleRate << " sampleRate: " << sampleRate
<< " centerFrequency: " << centerFrequency; << " centerFrequency: " << centerFrequency;
if (sourceElseSink) if (sourceElseSink)
{ {
if ((istream < m_deviceSampleMIMO->getNbSourceStreams())) if ((istream < m_deviceSampleMIMO->getNbSourceStreams()))
@ -984,6 +983,7 @@ void DSPDeviceMIMOEngine::handleInputMessages()
guiMessageQueue->push(rep); guiMessageQueue->push(rep);
} }
// forward changes to spectrum sink if currently active
if (m_spectrumSink && m_spectrumInputSourceElseSink && (m_spectrumInputIndex == istream)) if (m_spectrumSink && m_spectrumInputSourceElseSink && (m_spectrumInputIndex == istream))
{ {
DSPSignalNotification spectrumNotif(sampleRate, centerFrequency); DSPSignalNotification spectrumNotif(sampleRate, centerFrequency);
@ -1016,6 +1016,7 @@ void DSPDeviceMIMOEngine::handleInputMessages()
guiMessageQueue->push(rep); guiMessageQueue->push(rep);
} }
// forward changes to spectrum sink if currently active
if (m_spectrumSink && !m_spectrumInputSourceElseSink && (m_spectrumInputIndex == istream)) if (m_spectrumSink && !m_spectrumInputSourceElseSink && (m_spectrumInputIndex == istream))
{ {
DSPSignalNotification spectrumNotif(sampleRate, centerFrequency); DSPSignalNotification spectrumNotif(sampleRate, centerFrequency);