mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-19 16:15:49 -05:00
New scope: fixed trigger UI add, remove and change current
This commit is contained in:
parent
f1b5b08fa0
commit
ec604c21c9
@ -101,6 +101,13 @@ void ScopeVisNG::addTrigger(const TriggerData& triggerData)
|
||||
|
||||
void ScopeVisNG::changeTrigger(const TriggerData& triggerData, uint32_t triggerIndex)
|
||||
{
|
||||
qDebug() << "ScopeVisNG::changeTrigger:"
|
||||
<< " trigger: " << triggerIndex
|
||||
<< " m_projectionType: " << triggerData.m_projectionType
|
||||
<< " m_triggerRepeat: " << triggerData.m_triggerRepeat
|
||||
<< " m_triggerPositiveEdge: " << triggerData.m_triggerPositiveEdge
|
||||
<< " m_triggerBothEdges: " << triggerData.m_triggerBothEdges;
|
||||
;
|
||||
Message* cmd = MsgScopeVisNGChangeTrigger::create(triggerData, triggerIndex);
|
||||
getInputMessageQueue()->push(cmd);
|
||||
}
|
||||
|
@ -18,6 +18,8 @@
|
||||
#ifndef SDRBASE_DSP_SCOPEVISNG_H_
|
||||
#define SDRBASE_DSP_SCOPEVISNG_H_
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <vector>
|
||||
#include <boost/circular_buffer.hpp>
|
||||
@ -64,18 +66,28 @@ public:
|
||||
ProjectionType m_projectionType; //!< Complex to real projection type
|
||||
uint32_t m_inputIndex; //!< Input or feed index this trigger is associated with
|
||||
Real m_triggerLevel; //!< Level in real units
|
||||
int m_triggerLevelCoarse;
|
||||
int m_triggerLevelFine;
|
||||
bool m_triggerPositiveEdge; //!< Trigger on the positive edge (else negative)
|
||||
bool m_triggerBothEdges; //!< Trigger on both edges (else only one)
|
||||
uint32_t m_triggerDelay; //!< Delay before the trigger is kicked off in number of samples
|
||||
uint32_t m_triggerDelay; //!< Delay before the trigger is kicked off in number of samples (trigger delay)
|
||||
double m_triggerDelayMult; //!< Trigger delay as a multiplier of trace length
|
||||
int m_triggerDelayCoarse;
|
||||
int m_triggerDelayFine;
|
||||
uint32_t m_triggerRepeat; //!< Number of trigger conditions before the final decisive trigger
|
||||
|
||||
TriggerData() :
|
||||
m_projectionType(ProjectionReal),
|
||||
m_inputIndex(0),
|
||||
m_triggerLevel(0.0f),
|
||||
m_triggerLevelCoarse(0),
|
||||
m_triggerLevelFine(0),
|
||||
m_triggerPositiveEdge(true),
|
||||
m_triggerBothEdges(false),
|
||||
m_triggerDelay(0),
|
||||
m_triggerDelayMult(0.0),
|
||||
m_triggerDelayCoarse(0),
|
||||
m_triggerDelayFine(0),
|
||||
m_triggerRepeat(0)
|
||||
{}
|
||||
};
|
||||
@ -92,9 +104,20 @@ public:
|
||||
void changeTrace(const TraceData& traceData, uint32_t traceIndex);
|
||||
void removeTrace(uint32_t traceIndex);
|
||||
void addTrigger(const TriggerData& triggerData);
|
||||
void changeTrigger(const TriggerData& triggerData, uint32_t traceIndex);
|
||||
void changeTrigger(const TriggerData& triggerData, uint32_t triggerIndex);
|
||||
void removeTrigger(uint32_t triggerIndex);
|
||||
|
||||
void getTriggerData(TriggerData& triggerData, uint32_t triggerIndex)
|
||||
{
|
||||
if (triggerIndex < m_triggerConditions.size())
|
||||
{
|
||||
qDebug() << "copeVisNG::getTriggerData:"
|
||||
<< " index: " << triggerIndex
|
||||
<< " projection: " << (int) m_triggerConditions[triggerIndex].m_triggerData.m_projectionType;
|
||||
triggerData = m_triggerConditions[triggerIndex].m_triggerData;
|
||||
}
|
||||
}
|
||||
|
||||
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool positiveOnly);
|
||||
virtual void start();
|
||||
virtual void stop();
|
||||
|
@ -19,3 +19,8 @@ void ButtonSwitch::onToggled(bool checked)
|
||||
setPalette(m_originalPalette);
|
||||
}
|
||||
}
|
||||
|
||||
void ButtonSwitch::doToggle(bool checked)
|
||||
{
|
||||
onToggled(checked);
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ class ButtonSwitch : public QToolButton {
|
||||
|
||||
public:
|
||||
ButtonSwitch(QWidget* parent = NULL);
|
||||
void doToggle(bool checked);
|
||||
|
||||
private slots:
|
||||
void onToggled(bool checked);
|
||||
|
@ -260,6 +260,18 @@ void GLScopeNGGUI::on_traceLen_valueChanged(int value)
|
||||
void GLScopeNGGUI::on_trig_valueChanged(int value)
|
||||
{
|
||||
ui->trigText->setText(tr("%1").arg(value));
|
||||
|
||||
ScopeVisNG::TriggerData triggerData;
|
||||
m_scopeVis->getTriggerData(triggerData, value);
|
||||
|
||||
qDebug() << "GLScopeNGGUI::on_trig_valueChanged:"
|
||||
<< " m_projectionType: " << (int) triggerData.m_projectionType
|
||||
<< " m_triggerRepeat" << triggerData.m_triggerRepeat
|
||||
<< " m_triggerPositiveEdge" << triggerData.m_triggerPositiveEdge
|
||||
<< " m_triggerBothEdges" << triggerData.m_triggerBothEdges
|
||||
<< " m_triggerLevel" << triggerData.m_triggerLevel;
|
||||
|
||||
setTriggerUI(triggerData);
|
||||
}
|
||||
|
||||
void GLScopeNGGUI::on_trigAdd_clicked(bool checked)
|
||||
@ -275,7 +287,7 @@ void GLScopeNGGUI::on_trigAdd_clicked(bool checked)
|
||||
|
||||
void GLScopeNGGUI::on_trigDel_clicked(bool checked)
|
||||
{
|
||||
if (ui->trig->maximum() > 0)
|
||||
if (ui->trig->value() > 0)
|
||||
{
|
||||
m_scopeVis->removeTrigger(ui->trig->value());
|
||||
ui->trig->setMaximum(ui->trig->maximum() - 1);
|
||||
@ -320,10 +332,8 @@ void GLScopeNGGUI::on_trigMode_currentIndexChanged(int index)
|
||||
|
||||
void GLScopeNGGUI::on_trigCount_valueChanged(int value)
|
||||
{
|
||||
QString text;
|
||||
text.sprintf("%02d", value);
|
||||
ui->trigCountText->setText(text);
|
||||
changeCurrentTrigger();
|
||||
setTrigCountDisplay();
|
||||
changeCurrentTrigger();
|
||||
}
|
||||
|
||||
void GLScopeNGGUI::on_trigPos_toggled(bool checked)
|
||||
@ -420,6 +430,13 @@ void GLScopeNGGUI::setTraceIndexDisplay()
|
||||
ui->traceText->setText(tr("%1").arg(ui->trace->value()));
|
||||
}
|
||||
|
||||
void GLScopeNGGUI::setTrigCountDisplay()
|
||||
{
|
||||
QString text;
|
||||
text.sprintf("%02d", ui->trigCount->value());
|
||||
ui->trigCountText->setText(text);
|
||||
}
|
||||
|
||||
void GLScopeNGGUI::setTimeScaleDisplay()
|
||||
{
|
||||
m_sampleRate = m_glScope->getSampleRate();
|
||||
@ -671,19 +688,80 @@ void GLScopeNGGUI::fillTraceData(ScopeVisNG::TraceData& traceData)
|
||||
|
||||
void GLScopeNGGUI::fillTriggerData(ScopeVisNG::TriggerData& triggerData)
|
||||
{
|
||||
triggerData.m_projectionType = (ScopeVisNG::ProjectionType) ui->traceMode->currentIndex();
|
||||
triggerData.m_projectionType = (ScopeVisNG::ProjectionType) ui->trigMode->currentIndex();
|
||||
triggerData.m_inputIndex = 0;
|
||||
triggerData.m_triggerLevel = (ui->trigLevelCoarse->value() / 100.0) + (ui->trigLevelFine->value() / 20000.0);
|
||||
triggerData.m_triggerLevelCoarse = ui->trigLevelCoarse->value();
|
||||
triggerData.m_triggerLevelFine = ui->trigLevelFine->value();
|
||||
triggerData.m_triggerPositiveEdge = ui->trigPos->isChecked();
|
||||
triggerData.m_triggerBothEdges = ui->trigBoth->isChecked();
|
||||
triggerData.m_triggerRepeat = ui->trigCount->value();
|
||||
double delayMult = ui->trigDelayCoarse->value() + ui->trigDelayFine->value() / 100.0;
|
||||
triggerData.m_triggerDelay = (int) (m_traceLenMult * ScopeVisNG::m_traceChunkSize * delayMult);
|
||||
triggerData.m_triggerDelayMult = ui->trigDelayCoarse->value() + ui->trigDelayFine->value() / 100.0;
|
||||
triggerData.m_triggerDelay = (int) (m_traceLenMult * ScopeVisNG::m_traceChunkSize * triggerData.m_triggerDelayMult);
|
||||
triggerData.m_triggerDelayCoarse = ui->trigDelayCoarse->value();
|
||||
triggerData.m_triggerDelayFine = ui->trigDelayFine->value();
|
||||
}
|
||||
|
||||
void GLScopeNGGUI::setTriggerUI(ScopeVisNG::TriggerData& triggerData)
|
||||
{
|
||||
bool oldStateTrigMode = ui->trigMode->blockSignals(true);
|
||||
bool oldStateTrigCount = ui->trigCount->blockSignals(true);
|
||||
bool oldStateTrigPos = ui->trigPos->blockSignals(true);
|
||||
bool oldStateTrigNeg = ui->trigNeg->blockSignals(true);
|
||||
bool oldStateTrigBoth = ui->trigBoth->blockSignals(true);
|
||||
bool oldStateTrigLevelCoarse = ui->trigLevelCoarse->blockSignals(true);
|
||||
bool oldStateTrigLevelFine = ui->trigLevelFine->blockSignals(true);
|
||||
bool oldStateTrigDelayCoarse = ui->trigDelayCoarse->blockSignals(true);
|
||||
bool oldStateTrigDelayFine = ui->trigDelayFine->blockSignals(true);
|
||||
|
||||
ui->trigMode->setCurrentIndex((int) triggerData.m_projectionType);
|
||||
ui->trigCount->setValue(triggerData.m_triggerRepeat);
|
||||
setTrigCountDisplay();
|
||||
|
||||
ui->trigPos->setChecked(false);
|
||||
ui->trigNeg->setChecked(false);
|
||||
ui->trigPos->doToggle(false);
|
||||
ui->trigNeg->doToggle(false);
|
||||
|
||||
if (triggerData.m_triggerBothEdges)
|
||||
{
|
||||
ui->trigBoth->setChecked(true);
|
||||
ui->trigBoth->doToggle(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->trigBoth->setChecked(false);
|
||||
ui->trigBoth->doToggle(false);
|
||||
|
||||
if (triggerData.m_triggerPositiveEdge)
|
||||
{
|
||||
ui->trigPos->setChecked(true);
|
||||
ui->trigPos->doToggle(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->trigNeg->setChecked(true);
|
||||
ui->trigNeg->doToggle(true);
|
||||
}
|
||||
}
|
||||
|
||||
ui->trigLevelCoarse->setValue(triggerData.m_triggerLevelCoarse);
|
||||
ui->trigLevelFine->setValue(triggerData.m_triggerLevelFine);
|
||||
setTrigLevelDisplay();
|
||||
|
||||
ui->trigDelayCoarse->setValue(triggerData.m_triggerDelayCoarse);
|
||||
ui->trigDelayFine->setValue(triggerData.m_triggerDelayFine);
|
||||
setTrigDelayDisplay();
|
||||
|
||||
ui->trigMode->blockSignals(oldStateTrigMode);
|
||||
ui->trigCount->blockSignals(oldStateTrigCount);
|
||||
ui->trigPos->blockSignals(oldStateTrigPos);
|
||||
ui->trigNeg->blockSignals(oldStateTrigNeg);
|
||||
ui->trigBoth->blockSignals(oldStateTrigBoth);
|
||||
ui->trigLevelCoarse->blockSignals(oldStateTrigLevelCoarse);
|
||||
ui->trigLevelFine->blockSignals(oldStateTrigLevelFine);
|
||||
ui->trigDelayCoarse->blockSignals(oldStateTrigDelayCoarse);
|
||||
ui->trigDelayFine->blockSignals(oldStateTrigDelayFine);
|
||||
}
|
||||
|
||||
void GLScopeNGGUI::applySettings()
|
||||
|
@ -74,6 +74,7 @@ private:
|
||||
void setAmpOfsDisplay();
|
||||
// Third row
|
||||
void setTrigIndexDisplay();
|
||||
void setTrigCountDisplay();
|
||||
void setTrigLevelDisplay();
|
||||
void setTrigDelayDisplay();
|
||||
void setTrigPreDisplay();
|
||||
|
Loading…
Reference in New Issue
Block a user