mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-23 10:05:46 -05:00
Scope: added possibility to change trace chunk size
This commit is contained in:
parent
5a3176668f
commit
d3176ef578
@ -37,7 +37,7 @@ MESSAGE_CLASS_DEFINITION(ScopeVis::MsgScopeVisNGFocusOnTrace, Message)
|
||||
MESSAGE_CLASS_DEFINITION(ScopeVis::MsgScopeVisNGOneShot, Message)
|
||||
MESSAGE_CLASS_DEFINITION(ScopeVis::MsgScopeVisNGMemoryTrace, Message)
|
||||
|
||||
const uint ScopeVis::m_traceChunkSize = 4800;
|
||||
const uint ScopeVis::m_traceChunkDefaultSize = 4800;
|
||||
|
||||
|
||||
ScopeVis::ScopeVis(GLScope* glScope) :
|
||||
@ -48,8 +48,9 @@ ScopeVis::ScopeVis(GLScope* glScope) :
|
||||
m_focusedTriggerIndex(0),
|
||||
m_triggerState(TriggerUntriggered),
|
||||
m_focusedTraceIndex(0),
|
||||
m_traceSize(m_traceChunkSize),
|
||||
m_liveTraceSize(m_traceChunkSize),
|
||||
m_traceChunkSize(m_traceChunkDefaultSize),
|
||||
m_traceSize(m_traceChunkDefaultSize),
|
||||
m_liveTraceSize(m_traceChunkDefaultSize),
|
||||
m_nbSamples(0),
|
||||
m_timeBase(1),
|
||||
m_timeOfsProMill(0),
|
||||
@ -66,7 +67,7 @@ ScopeVis::ScopeVis(GLScope* glScope) :
|
||||
m_currentTraceMemoryIndex(0)
|
||||
{
|
||||
setObjectName("ScopeVis");
|
||||
m_traceDiscreteMemory.resize(m_traceChunkSize); // arbitrary
|
||||
m_traceDiscreteMemory.resize(m_traceChunkDefaultSize); // arbitrary
|
||||
m_glScope->setTraces(&m_traces.m_tracesData, &m_traces.m_traces[0]);
|
||||
for (int i = 0; i < (int) Projector::nbProjectionTypes; i++) {
|
||||
m_projectorCache[i] = 0.0;
|
||||
|
@ -147,7 +147,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
static const uint32_t m_traceChunkSize;
|
||||
static const uint32_t m_traceChunkDefaultSize;
|
||||
static const uint32_t m_maxNbTriggers = 10;
|
||||
static const uint32_t m_maxNbTraces = 10;
|
||||
static const uint32_t m_nbTraceMemories = 50;
|
||||
@ -170,6 +170,8 @@ public:
|
||||
void focusOnTrigger(uint32_t triggerIndex);
|
||||
void setOneShot(bool oneShot);
|
||||
void setMemoryIndex(uint32_t memoryIndex);
|
||||
void setTraceChunkSize(uint32_t chunkSize) { m_traceChunkSize = chunkSize; }
|
||||
uint32_t getTraceChunkSize() const { return m_traceChunkSize; }
|
||||
|
||||
QByteArray serializeMemory() const
|
||||
{
|
||||
@ -199,7 +201,7 @@ public:
|
||||
QByteArray buf;
|
||||
bool traceDiscreteMemorySuccess;
|
||||
|
||||
d.readU32(1, &traceSize, m_traceChunkSize);
|
||||
d.readU32(1, &traceSize, m_traceChunkDefaultSize);
|
||||
d.readU32(2, &preTriggerDelay, 0);
|
||||
d.readS32(3, &sampleRate, 0);
|
||||
setSampleRate(sampleRate);
|
||||
@ -1127,6 +1129,7 @@ private:
|
||||
TriggerState m_triggerState; //!< Current trigger state
|
||||
Traces m_traces; //!< Displayable traces
|
||||
int m_focusedTraceIndex; //!< Index of the trace that has focus
|
||||
uint32_t m_traceChunkSize; //!< Trace length unit size in number of samples
|
||||
uint32_t m_traceSize; //!< Size of traces in number of samples
|
||||
uint32_t m_liveTraceSize; //!< Size of traces in number of samples in live mode
|
||||
int m_nbSamples; //!< Number of samples yet to process in one complex trace
|
||||
|
@ -51,7 +51,7 @@ GLScopeGUI::GLScopeGUI(QWidget* parent) :
|
||||
qDebug("GLScopeGUI::GLScopeGUI");
|
||||
setEnabled(false);
|
||||
ui->setupUi(this);
|
||||
ui->trigDelayFine->setMaximum(ScopeVis::m_traceChunkSize / 10.0);
|
||||
ui->trigDelayFine->setMaximum(ScopeVis::m_traceChunkDefaultSize / 10.0);
|
||||
ui->traceColor->setStyleSheet("QLabel { background-color : rgb(255,255,64); }");
|
||||
m_focusedTraceColor.setRgb(255,255,64);
|
||||
ui->trigColor->setStyleSheet("QLabel { background-color : rgb(0,255,0); }");
|
||||
@ -114,13 +114,13 @@ void GLScopeGUI::setBuddies(MessageQueue* messageQueue, ScopeVis* scopeVis, GLSc
|
||||
ui->trigMode->clear();
|
||||
fillProjectionCombo(ui->trigMode);
|
||||
|
||||
m_scopeVis->configure(2*m_traceLenMult*ScopeVis::m_traceChunkSize,
|
||||
m_scopeVis->configure(2*m_traceLenMult*m_scopeVis->getTraceChunkSize(),
|
||||
m_timeBase,
|
||||
m_timeOffset*10,
|
||||
(uint32_t) (m_glScope->getTraceSize() * (ui->trigPre->value()/100.0f)),
|
||||
ui->freerun->isChecked());
|
||||
|
||||
m_scopeVis->configure(m_traceLenMult*ScopeVis::m_traceChunkSize,
|
||||
m_scopeVis->configure(m_traceLenMult*m_scopeVis->getTraceChunkSize(),
|
||||
m_timeBase,
|
||||
m_timeOffset*10,
|
||||
(uint32_t) (m_glScope->getTraceSize() * (ui->trigPre->value()/100.0f)),
|
||||
@ -155,7 +155,7 @@ void GLScopeGUI::on_scope_sampleRateChanged(int sampleRate)
|
||||
void GLScopeGUI::on_scope_traceSizeChanged(uint32_t traceNbSamples)
|
||||
{
|
||||
qDebug("GLScopeGUI::on_scope_traceSizeChanged: %u", traceNbSamples);
|
||||
m_traceLenMult = traceNbSamples / ScopeVis::m_traceChunkSize;
|
||||
m_traceLenMult = traceNbSamples / m_scopeVis->getTraceChunkSize();
|
||||
ui->traceLen->setValue(m_traceLenMult);
|
||||
setTraceLenDisplay();
|
||||
}
|
||||
@ -557,7 +557,7 @@ void GLScopeGUI::on_time_valueChanged(int value)
|
||||
m_timeBase = value;
|
||||
setTimeScaleDisplay();
|
||||
setTraceDelayDisplay();
|
||||
m_scopeVis->configure(m_traceLenMult*ScopeVis::m_traceChunkSize,
|
||||
m_scopeVis->configure(m_traceLenMult*m_scopeVis->getTraceChunkSize(),
|
||||
m_timeBase,
|
||||
m_timeOffset*10,
|
||||
(uint32_t) (m_glScope->getTraceSize() * (ui->trigPre->value()/100.0f)),
|
||||
@ -572,7 +572,7 @@ void GLScopeGUI::on_timeOfs_valueChanged(int value)
|
||||
|
||||
m_timeOffset = value;
|
||||
setTimeOfsDisplay();
|
||||
m_scopeVis->configure(m_traceLenMult*ScopeVis::m_traceChunkSize,
|
||||
m_scopeVis->configure(m_traceLenMult*m_scopeVis->getTraceChunkSize(),
|
||||
m_timeBase,
|
||||
m_timeOffset*10,
|
||||
(uint32_t) (m_glScope->getTraceSize() * (ui->trigPre->value()/100.0f)),
|
||||
@ -586,7 +586,7 @@ void GLScopeGUI::on_traceLen_valueChanged(int value)
|
||||
}
|
||||
|
||||
m_traceLenMult = value;
|
||||
m_scopeVis->configure(m_traceLenMult*ScopeVis::m_traceChunkSize,
|
||||
m_scopeVis->configure(m_traceLenMult*m_scopeVis->getTraceChunkSize(),
|
||||
m_timeBase,
|
||||
m_timeOffset*10,
|
||||
(uint32_t) (m_glScope->getTraceSize() * (ui->trigPre->value()/100.0f)),
|
||||
@ -956,7 +956,7 @@ void GLScopeGUI::on_trigPre_valueChanged(int value)
|
||||
{
|
||||
(void) value;
|
||||
setTrigPreDisplay();
|
||||
m_scopeVis->configure(m_traceLenMult*ScopeVis::m_traceChunkSize,
|
||||
m_scopeVis->configure(m_traceLenMult*m_scopeVis->getTraceChunkSize(),
|
||||
m_timeBase,
|
||||
m_timeOffset*10,
|
||||
(uint32_t) (m_glScope->getTraceSize() * (ui->trigPre->value()/100.0f)),
|
||||
@ -994,7 +994,7 @@ void GLScopeGUI::on_freerun_toggled(bool checked)
|
||||
ui->trigOneShot->setEnabled(true);
|
||||
}
|
||||
|
||||
m_scopeVis->configure(m_traceLenMult*ScopeVis::m_traceChunkSize,
|
||||
m_scopeVis->configure(m_traceLenMult*m_scopeVis->getTraceChunkSize(),
|
||||
m_timeBase,
|
||||
m_timeOffset*10,
|
||||
(uint32_t) (m_glScope->getTraceSize() * (ui->trigPre->value()/100.0f)),
|
||||
@ -1051,7 +1051,7 @@ void GLScopeGUI::setTimeScaleDisplay()
|
||||
|
||||
void GLScopeGUI::setTraceLenDisplay()
|
||||
{
|
||||
unsigned int n_samples = m_traceLenMult * ScopeVis::m_traceChunkSize;
|
||||
unsigned int n_samples = m_traceLenMult * m_scopeVis->getTraceChunkSize();
|
||||
|
||||
if (n_samples < 1000) {
|
||||
ui->traceLenText->setToolTip(tr("%1 S").arg(n_samples));
|
||||
@ -1230,8 +1230,8 @@ void GLScopeGUI::setTrigDelayDisplay()
|
||||
{
|
||||
if (m_sampleRate > 0)
|
||||
{
|
||||
double delayMult = ui->trigDelayCoarse->value() + ui->trigDelayFine->value() / (ScopeVis::m_traceChunkSize / 10.0);
|
||||
unsigned int n_samples_delay = m_traceLenMult * ScopeVis::m_traceChunkSize * delayMult;
|
||||
double delayMult = ui->trigDelayCoarse->value() + ui->trigDelayFine->value() / (m_scopeVis->getTraceChunkSize() / 10.0);
|
||||
unsigned int n_samples_delay = m_traceLenMult * m_scopeVis->getTraceChunkSize() * delayMult;
|
||||
|
||||
if (n_samples_delay < 1000) {
|
||||
ui->trigDelayText->setToolTip(tr("%1 S").arg(n_samples_delay));
|
||||
@ -1374,8 +1374,8 @@ void GLScopeGUI::fillTriggerData(ScopeVis::TriggerData& triggerData)
|
||||
triggerData.m_triggerBothEdges = ui->trigBoth->isChecked();
|
||||
triggerData.m_triggerHoldoff = ui->trigHoldoff->value();
|
||||
triggerData.m_triggerRepeat = ui->trigCount->value();
|
||||
triggerData.m_triggerDelayMult = ui->trigDelayCoarse->value() + ui->trigDelayFine->value() / (ScopeVis::m_traceChunkSize / 10.0);
|
||||
triggerData.m_triggerDelay = (int) (m_traceLenMult * ScopeVis::m_traceChunkSize * triggerData.m_triggerDelayMult);
|
||||
triggerData.m_triggerDelayMult = ui->trigDelayCoarse->value() + ui->trigDelayFine->value() / (m_scopeVis->getTraceChunkSize() / 10.0);
|
||||
triggerData.m_triggerDelay = (int) (m_traceLenMult * m_scopeVis->getTraceChunkSize() * triggerData.m_triggerDelayMult);
|
||||
triggerData.m_triggerDelayCoarse = ui->trigDelayCoarse->value();
|
||||
triggerData.m_triggerDelayFine = ui->trigDelayFine->value();
|
||||
triggerData.setColor(m_focusedTriggerColor);
|
||||
@ -1694,4 +1694,7 @@ void GLScopeGUI::focusOnTrigger(int triggerIndex)
|
||||
on_trig_valueChanged(triggerIndex);
|
||||
}
|
||||
|
||||
|
||||
void GLScopeGUI::traceLengthChange()
|
||||
{
|
||||
on_traceLen_valueChanged(m_traceLenMult);
|
||||
}
|
||||
|
@ -76,6 +76,7 @@ public:
|
||||
void changeTrigger(int triggerIndex, const ScopeVis::TriggerData& triggerData);
|
||||
void addTrigger(const ScopeVis::TriggerData& triggerData);
|
||||
void focusOnTrigger(int triggerIndex);
|
||||
void traceLengthChange();
|
||||
|
||||
private:
|
||||
class TrigUIBlocker
|
||||
|
Loading…
Reference in New Issue
Block a user