New scope: pass time base to ScopeVis

This commit is contained in:
f4exb 2017-02-26 04:55:15 +01:00
parent 6c60189fdc
commit b3cb4d3f70
3 changed files with 32 additions and 7 deletions

View File

@ -77,9 +77,9 @@ void ScopeVisNG::setSampleRate(int sampleRate)
}
}
void ScopeVisNG::configure(uint32_t traceSize, uint32_t timeOfsProMill, uint32_t triggerPre, bool freeRun)
void ScopeVisNG::configure(uint32_t traceSize, uint32_t timeBase, uint32_t timeOfsProMill, uint32_t triggerPre, bool freeRun)
{
Message* cmd = MsgConfigureScopeVisNG::create(traceSize, timeOfsProMill, triggerPre, freeRun);
Message* cmd = MsgConfigureScopeVisNG::create(traceSize, timeBase, timeOfsProMill, triggerPre, freeRun);
getInputMessageQueue()->push(cmd);
}
@ -536,6 +536,7 @@ bool ScopeVisNG::handleMessage(const Message& message)
MsgConfigureScopeVisNG& conf = (MsgConfigureScopeVisNG&) message;
uint32_t traceSize = conf.getTraceSize();
uint32_t timeBase = conf.getTimeBase();
uint32_t timeOfsProMill = conf.getTimeOfsProMill();
uint32_t triggerPre = conf.getTriggerPre();
bool freeRun = conf.getFreeRun();
@ -552,6 +553,15 @@ bool ScopeVisNG::handleMessage(const Message& message)
}
}
if (m_timeBase != timeBase)
{
m_timeBase = timeBase;
if (m_glScope) {
m_glScope->setTimeBase(m_timeBase);
}
}
if (m_timeOfsProMill != timeOfsProMill)
{
m_timeOfsProMill = timeOfsProMill;

View File

@ -154,7 +154,7 @@ public:
virtual ~ScopeVisNG();
void setSampleRate(int sampleRate);
void configure(uint32_t traceSize, uint32_t timeOfsProMill, uint32_t triggerPre, bool freeRun);
void configure(uint32_t traceSize, uint32_t timeBase, uint32_t timeOfsProMill, uint32_t triggerPre, bool freeRun);
void addTrace(const TraceData& traceData);
void changeTrace(const TraceData& traceData, uint32_t traceIndex);
void removeTrace(uint32_t traceIndex);
@ -201,29 +201,34 @@ private:
public:
static MsgConfigureScopeVisNG* create(
uint32_t traceSize,
uint32_t timeBase,
uint32_t timeOfsProMill,
uint32_t triggerPre,
bool freeRun)
{
return new MsgConfigureScopeVisNG(traceSize, timeOfsProMill, triggerPre, freeRun);
return new MsgConfigureScopeVisNG(traceSize, timeBase, timeOfsProMill, triggerPre, freeRun);
}
uint32_t getTraceSize() const { return m_traceSize; }
uint32_t getTimeBase() const { return m_timeBase; }
uint32_t getTimeOfsProMill() const { return m_timeOfsProMill; }
uint32_t getTriggerPre() const { return m_triggerPre; }
bool getFreeRun() const { return m_freeRun; }
private:
uint32_t m_traceSize;
uint32_t m_timeBase;
uint32_t m_timeOfsProMill;
uint32_t m_triggerPre;
bool m_freeRun;
MsgConfigureScopeVisNG(uint32_t traceSize,
uint32_t timeBase,
uint32_t timeOfsProMill,
uint32_t triggerPre,
bool freeRun) :
m_traceSize(traceSize),
m_timeBase(timeBase),
m_timeOfsProMill(timeOfsProMill),
m_triggerPre(triggerPre),
m_freeRun(freeRun)

View File

@ -100,11 +100,13 @@ void GLScopeNGGUI::setBuddies(MessageQueue* messageQueue, ScopeVisNG* scopeVis,
fillProjectionCombo(ui->trigMode);
m_scopeVis->configure(2*m_traceLenMult*ScopeVisNG::m_traceChunkSize,
m_timeBase,
m_timeOffset*10,
(uint32_t) (m_glScope->getTraceSize() * (ui->trigPre->value()/100.0f)),
ui->freerun->isChecked());
m_scopeVis->configure(m_traceLenMult*ScopeVisNG::m_traceChunkSize,
m_timeBase,
m_timeOffset*10,
(uint32_t) (m_glScope->getTraceSize() * (ui->trigPre->value()/100.0f)),
ui->freerun->isChecked());
@ -485,7 +487,11 @@ void GLScopeNGGUI::on_time_valueChanged(int value)
m_timeBase = value;
setTimeScaleDisplay();
setTraceDelayDisplay();
m_glScope->setTimeBase(m_timeBase);
m_scopeVis->configure(m_traceLenMult*ScopeVisNG::m_traceChunkSize,
m_timeBase,
m_timeOffset*10,
(uint32_t) (m_glScope->getTraceSize() * (ui->trigPre->value()/100.0f)),
ui->freerun->isChecked());
}
void GLScopeNGGUI::on_timeOfs_valueChanged(int value)
@ -497,6 +503,7 @@ void GLScopeNGGUI::on_timeOfs_valueChanged(int value)
m_timeOffset = value;
setTimeOfsDisplay();
m_scopeVis->configure(m_traceLenMult*ScopeVisNG::m_traceChunkSize,
m_timeBase,
m_timeOffset*10,
(uint32_t) (m_glScope->getTraceSize() * (ui->trigPre->value()/100.0f)),
ui->freerun->isChecked());
@ -510,6 +517,7 @@ void GLScopeNGGUI::on_traceLen_valueChanged(int value)
m_traceLenMult = value;
m_scopeVis->configure(m_traceLenMult*ScopeVisNG::m_traceChunkSize,
m_timeBase,
m_timeOffset*10,
(uint32_t) (m_glScope->getTraceSize() * (ui->trigPre->value()/100.0f)),
ui->freerun->isChecked());
@ -749,9 +757,10 @@ void GLScopeNGGUI::on_trigPre_valueChanged(int value)
{
setTrigPreDisplay();
m_scopeVis->configure(m_traceLenMult*ScopeVisNG::m_traceChunkSize,
m_timeBase,
m_timeOffset*10,
(uint32_t) (m_glScope->getTraceSize() * (ui->trigPre->value()/100.0f)),
ui->freerun->isChecked()); // TODO: implement one shot feature
ui->freerun->isChecked());
}
void GLScopeNGGUI::on_trigColor_clicked()
@ -786,9 +795,10 @@ void GLScopeNGGUI::on_freerun_toggled(bool checked)
}
m_scopeVis->configure(m_traceLenMult*ScopeVisNG::m_traceChunkSize,
m_timeBase,
m_timeOffset*10,
(uint32_t) (m_glScope->getTraceSize() * (ui->trigPre->value()/100.0f)),
ui->freerun->isChecked()); // TODO: implement one shot feature
ui->freerun->isChecked());
}
void GLScopeNGGUI::setTraceIndexDisplay()