mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-07-12 05:45:21 -04:00
New scope: interim state (8)
This commit is contained in:
parent
44e764f492
commit
0f5c055eca
@ -78,6 +78,7 @@ void ScopeVisNG::addTrace(const TraceData& traceData)
|
|||||||
|
|
||||||
void ScopeVisNG::changeTrace(const TraceData& traceData, uint32_t traceIndex)
|
void ScopeVisNG::changeTrace(const TraceData& traceData, uint32_t traceIndex)
|
||||||
{
|
{
|
||||||
|
qDebug("ScopeVisNG::changeTrace: trace #%d", traceIndex);
|
||||||
Message* cmd = MsgScopeVisNGChangeTrace::create(traceData, traceIndex);
|
Message* cmd = MsgScopeVisNGChangeTrace::create(traceData, traceIndex);
|
||||||
getInputMessageQueue()->push(cmd);
|
getInputMessageQueue()->push(cmd);
|
||||||
}
|
}
|
||||||
@ -472,6 +473,8 @@ bool ScopeVisNG::handleMessage(const Message& message)
|
|||||||
m_traces[traceIndex].setData(conf.getTraceData());
|
m_traces[traceIndex].setData(conf.getTraceData());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_glScope->updateDisplay();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (MsgScopeVisNGRemoveTrace::match(message))
|
else if (MsgScopeVisNGRemoveTrace::match(message))
|
||||||
|
@ -67,6 +67,7 @@ void GLScopeNG::addTrace(ScopeVisNG::DisplayTrace *trace)
|
|||||||
{
|
{
|
||||||
m_traces.push_back(trace);
|
m_traces.push_back(trace);
|
||||||
m_configChanged = true;
|
m_configChanged = true;
|
||||||
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLScopeNG::removeTrace(int index)
|
void GLScopeNG::removeTrace(int index)
|
||||||
@ -76,6 +77,7 @@ void GLScopeNG::removeTrace(int index)
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_configChanged = true;
|
m_configChanged = true;
|
||||||
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLScopeNG::setDisplayGridIntensity(int intensity)
|
void GLScopeNG::setDisplayGridIntensity(int intensity)
|
||||||
@ -373,6 +375,12 @@ void GLScopeNG::setTraceSize(int traceSize)
|
|||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GLScopeNG::updateDisplay()
|
||||||
|
{
|
||||||
|
m_configChanged = true;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
void GLScopeNG::applyConfig()
|
void GLScopeNG::applyConfig()
|
||||||
{
|
{
|
||||||
m_configChanged = false;
|
m_configChanged = false;
|
||||||
|
@ -65,6 +65,7 @@ public:
|
|||||||
void setHighlightedTraceIndex(uint32_t traceIndex);
|
void setHighlightedTraceIndex(uint32_t traceIndex);
|
||||||
void setDisplayMode(DisplayMode displayMode);
|
void setDisplayMode(DisplayMode displayMode);
|
||||||
void setTraceSize(int trceSize);
|
void setTraceSize(int trceSize);
|
||||||
|
void updateDisplay();
|
||||||
void setDisplayGridIntensity(int intensity);
|
void setDisplayGridIntensity(int intensity);
|
||||||
void setDisplayTraceIntensity(int intensity);
|
void setDisplayTraceIntensity(int intensity);
|
||||||
|
|
||||||
|
@ -33,14 +33,9 @@ GLScopeNGGUI::GLScopeNGGUI(QWidget* parent) :
|
|||||||
m_timeBase(1),
|
m_timeBase(1),
|
||||||
m_timeOffset(0)
|
m_timeOffset(0)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
qDebug("GLScopeNGGUI::GLScopeNGGUI");
|
||||||
setEnabled(false);
|
setEnabled(false);
|
||||||
|
ui->setupUi(this);
|
||||||
ui->traceMode->clear();
|
|
||||||
fillProjectionCombo(ui->traceMode);
|
|
||||||
|
|
||||||
ui->trigMode->clear();
|
|
||||||
fillProjectionCombo(ui->trigMode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GLScopeNGGUI::~GLScopeNGGUI()
|
GLScopeNGGUI::~GLScopeNGGUI()
|
||||||
@ -50,6 +45,8 @@ GLScopeNGGUI::~GLScopeNGGUI()
|
|||||||
|
|
||||||
void GLScopeNGGUI::setBuddies(MessageQueue* messageQueue, ScopeVisNG* scopeVis, GLScopeNG* glScope)
|
void GLScopeNGGUI::setBuddies(MessageQueue* messageQueue, ScopeVisNG* scopeVis, GLScopeNG* glScope)
|
||||||
{
|
{
|
||||||
|
qDebug("GLScopeNGGUI::setBuddies");
|
||||||
|
|
||||||
m_messageQueue = messageQueue;
|
m_messageQueue = messageQueue;
|
||||||
m_scopeVis = scopeVis;
|
m_scopeVis = scopeVis;
|
||||||
m_glScope = glScope;
|
m_glScope = glScope;
|
||||||
@ -81,12 +78,19 @@ void GLScopeNGGUI::setBuddies(MessageQueue* messageQueue, ScopeVisNG* scopeVis,
|
|||||||
setEnabled(true);
|
setEnabled(true);
|
||||||
connect(m_glScope, SIGNAL(sampleRateChanged(int)), this, SLOT(on_scope_sampleRateChanged(int)));
|
connect(m_glScope, SIGNAL(sampleRateChanged(int)), this, SLOT(on_scope_sampleRateChanged(int)));
|
||||||
|
|
||||||
|
ui->traceMode->clear();
|
||||||
|
fillProjectionCombo(ui->traceMode);
|
||||||
|
|
||||||
|
ui->trigMode->clear();
|
||||||
|
fillProjectionCombo(ui->trigMode);
|
||||||
|
|
||||||
m_scopeVis->configure(2*m_traceLenMult*ScopeVisNG::m_traceChunkSize, m_timeOffset*10);
|
m_scopeVis->configure(2*m_traceLenMult*ScopeVisNG::m_traceChunkSize, m_timeOffset*10);
|
||||||
m_scopeVis->configure(m_traceLenMult*ScopeVisNG::m_traceChunkSize, m_timeOffset*10);
|
m_scopeVis->configure(m_traceLenMult*ScopeVisNG::m_traceChunkSize, m_timeOffset*10);
|
||||||
|
|
||||||
setTraceLenDisplay();
|
setTraceLenDisplay();
|
||||||
setTimeScaleDisplay();
|
setTimeScaleDisplay();
|
||||||
setTimeOfsDisplay();
|
setTimeOfsDisplay();
|
||||||
|
setAmpScaleDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLScopeNGGUI::setSampleRate(int sampleRate)
|
void GLScopeNGGUI::setSampleRate(int sampleRate)
|
||||||
@ -237,6 +241,18 @@ void GLScopeNGGUI::on_traceLen_valueChanged(int value)
|
|||||||
setTimeOfsDisplay();
|
setTimeOfsDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GLScopeNGGUI::on_traceMode_currentIndexChanged(int index)
|
||||||
|
{
|
||||||
|
setAmpScaleDisplay();
|
||||||
|
changeCurrentTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GLScopeNGGUI::on_amp_valueChanged(int value)
|
||||||
|
{
|
||||||
|
setAmpScaleDisplay();
|
||||||
|
changeCurrentTrace();
|
||||||
|
}
|
||||||
|
|
||||||
void GLScopeNGGUI::setTimeScaleDisplay()
|
void GLScopeNGGUI::setTimeScaleDisplay()
|
||||||
{
|
{
|
||||||
m_sampleRate = m_glScope->getSampleRate();
|
m_sampleRate = m_glScope->getSampleRate();
|
||||||
@ -303,6 +319,45 @@ void GLScopeNGGUI::setTimeOfsDisplay()
|
|||||||
ui->timeOfsText->setText(tr("%1\ns").arg(dt * 1.0));
|
ui->timeOfsText->setText(tr("%1\ns").arg(dt * 1.0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GLScopeNGGUI::setAmpScaleDisplay()
|
||||||
|
{
|
||||||
|
ScopeVisNG::ProjectionType projectionType = (ScopeVisNG::ProjectionType) ui->traceMode->currentIndex();
|
||||||
|
float ampValue = amps[ui->amp->value()];
|
||||||
|
|
||||||
|
if (projectionType == ScopeVisNG::ProjectionMagDB)
|
||||||
|
{
|
||||||
|
float displayValue = ampValue*500.0f;
|
||||||
|
|
||||||
|
if (displayValue < 10.0f) {
|
||||||
|
ui->ampText->setText(tr("%1\ndB").arg(displayValue, 0, 'f', 2));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ui->ampText->setText(tr("%1\ndB").arg(displayValue, 0, 'f', 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qreal a = ampValue*10.0f;
|
||||||
|
|
||||||
|
if(a < 0.000001)
|
||||||
|
ui->ampText->setText(tr("%1\nn").arg(a * 1000000000.0));
|
||||||
|
else if(a < 0.001)
|
||||||
|
ui->ampText->setText(tr("%1\nµ").arg(a * 1000000.0));
|
||||||
|
else if(a < 1.0)
|
||||||
|
ui->ampText->setText(tr("%1\nm").arg(a * 1000.0));
|
||||||
|
else
|
||||||
|
ui->ampText->setText(tr("%1").arg(a * 1.0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GLScopeNGGUI::changeCurrentTrace()
|
||||||
|
{
|
||||||
|
ScopeVisNG::TraceData traceData;
|
||||||
|
fillTraceData(traceData);
|
||||||
|
uint32_t currentTraceIndex = ui->trace->value();
|
||||||
|
m_scopeVis->changeTrace(traceData, currentTraceIndex);
|
||||||
|
}
|
||||||
|
|
||||||
void GLScopeNGGUI::fillProjectionCombo(QComboBox* comboBox)
|
void GLScopeNGGUI::fillProjectionCombo(QComboBox* comboBox)
|
||||||
{
|
{
|
||||||
comboBox->addItem("Real", ScopeVisNG::ProjectionReal);
|
comboBox->addItem("Real", ScopeVisNG::ProjectionReal);
|
||||||
|
@ -67,6 +67,9 @@ private:
|
|||||||
void setTimeScaleDisplay();
|
void setTimeScaleDisplay();
|
||||||
void setTraceLenDisplay();
|
void setTraceLenDisplay();
|
||||||
void setTimeOfsDisplay();
|
void setTimeOfsDisplay();
|
||||||
|
void setAmpScaleDisplay();
|
||||||
|
|
||||||
|
void changeCurrentTrace();
|
||||||
|
|
||||||
void fillTraceData(ScopeVisNG::TraceData& traceData);
|
void fillTraceData(ScopeVisNG::TraceData& traceData);
|
||||||
void fillTriggerData(ScopeVisNG::TriggerData& triggerData);
|
void fillTriggerData(ScopeVisNG::TriggerData& triggerData);
|
||||||
@ -85,6 +88,8 @@ private slots:
|
|||||||
void on_time_valueChanged(int value);
|
void on_time_valueChanged(int value);
|
||||||
void on_timeOfs_valueChanged(int value);
|
void on_timeOfs_valueChanged(int value);
|
||||||
void on_traceLen_valueChanged(int value);
|
void on_traceLen_valueChanged(int value);
|
||||||
|
void on_traceMode_currentIndexChanged(int index);
|
||||||
|
void on_amp_valueChanged(int value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -643,7 +643,7 @@ kS/s</string>
|
|||||||
<widget class="QComboBox" name="traceMode">
|
<widget class="QComboBox" name="traceMode">
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>56</width>
|
<width>65</width>
|
||||||
<height>16777215</height>
|
<height>16777215</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
@ -1149,7 +1149,7 @@ kS/s</string>
|
|||||||
<widget class="QComboBox" name="trigMode">
|
<widget class="QComboBox" name="trigMode">
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>56</width>
|
<width>65</width>
|
||||||
<height>16777215</height>
|
<height>16777215</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user