1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-05-29 05:22:25 -04:00

New scope: one shot trigger support

This commit is contained in:
f4exb 2017-02-22 01:18:50 +01:00
parent 4e102ad86d
commit d310d59142
3 changed files with 45 additions and 14 deletions

View File

@ -31,6 +31,7 @@ MESSAGE_CLASS_DEFINITION(ScopeVisNG::MsgScopeVisNGAddTrace, Message)
MESSAGE_CLASS_DEFINITION(ScopeVisNG::MsgScopeVisNGChangeTrace, Message) MESSAGE_CLASS_DEFINITION(ScopeVisNG::MsgScopeVisNGChangeTrace, Message)
MESSAGE_CLASS_DEFINITION(ScopeVisNG::MsgScopeVisNGRemoveTrace, Message) MESSAGE_CLASS_DEFINITION(ScopeVisNG::MsgScopeVisNGRemoveTrace, Message)
MESSAGE_CLASS_DEFINITION(ScopeVisNG::MsgScopeVisNGFocusOnTrace, Message) MESSAGE_CLASS_DEFINITION(ScopeVisNG::MsgScopeVisNGFocusOnTrace, Message)
MESSAGE_CLASS_DEFINITION(ScopeVisNG::MsgScopeVisNGOneShot, Message)
const uint ScopeVisNG::m_traceChunkSize = 4800; const uint ScopeVisNG::m_traceChunkSize = 4800;
@ -51,7 +52,9 @@ ScopeVisNG::ScopeVisNG(GLScopeNG* glScope) :
m_sampleRate(0), m_sampleRate(0),
m_traceDiscreteMemory(10), m_traceDiscreteMemory(10),
m_freeRun(true), m_freeRun(true),
m_maxTraceDelay(0) m_maxTraceDelay(0),
m_triggerOneShot(false),
m_triggerWaitForReset(false)
{ {
setObjectName("ScopeVisNG"); setObjectName("ScopeVisNG");
m_traceDiscreteMemory.resize(m_traceChunkSize); // arbitrary m_traceDiscreteMemory.resize(m_traceChunkSize); // arbitrary
@ -136,6 +139,11 @@ void ScopeVisNG::focusOnTrigger(uint32_t triggerIndex)
getInputMessageQueue()->push(cmd); getInputMessageQueue()->push(cmd);
} }
void ScopeVisNG::setOneShot(bool oneShot)
{
Message* cmd = MsgScopeVisNGOneShot::create(oneShot);
getInputMessageQueue()->push(cmd);
}
void ScopeVisNG::feed(const SampleVector::const_iterator& cbegin, const SampleVector::const_iterator& end, bool positiveOnly) void ScopeVisNG::feed(const SampleVector::const_iterator& cbegin, const SampleVector::const_iterator& end, bool positiveOnly)
{ {
@ -148,20 +156,14 @@ void ScopeVisNG::feed(const SampleVector::const_iterator& cbegin, const SampleVe
else if (m_triggerState == TriggerUntriggered) { else if (m_triggerState == TriggerUntriggered) {
m_triggerPoint = end; m_triggerPoint = end;
} }
else if (m_triggerState == TriggerWait) { else if (m_triggerWaitForReset) {
m_triggerPoint = end; m_triggerPoint = end;
} }
else { else {
m_triggerPoint = cbegin; m_triggerPoint = cbegin;
} }
// if (m_triggerState == TriggerNewConfig) if (m_triggerWaitForReset) {
// {
// m_triggerState = TriggerUntriggered;
// return;
// }
if ((m_triggerConditions.size() > 0) && (m_triggerState == TriggerWait)) {
return; return;
} }
@ -332,6 +334,8 @@ void ScopeVisNG::processTrace(const SampleVector::const_iterator& cbegin, const
m_traceDiscreteMemory.current().m_endPoint = mbegin; m_traceDiscreteMemory.current().m_endPoint = mbegin;
m_traceDiscreteMemory.store(); // next memory trace m_traceDiscreteMemory.store(); // next memory trace
m_triggerState = TriggerUntriggered; m_triggerState = TriggerUntriggered;
m_triggerWaitForReset = m_triggerOneShot;
//if (m_glScope) m_glScope->incrementTraceCounter(); //if (m_glScope) m_glScope->incrementTraceCounter();
// process remainder recursively // process remainder recursively
@ -616,6 +620,13 @@ bool ScopeVisNG::handleMessage(const Message& message)
return true; return true;
} }
else if (MsgScopeVisNGOneShot::match(message))
{
MsgScopeVisNGOneShot& conf = (MsgScopeVisNGOneShot&) message;
bool oneShot = conf.getOneShot();
m_triggerOneShot = oneShot;
if (m_triggerWaitForReset && !oneShot) m_triggerWaitForReset = false;
}
else else
{ {
return false; return false;

View File

@ -159,6 +159,7 @@ public:
void changeTrigger(const TriggerData& triggerData, uint32_t triggerIndex); void changeTrigger(const TriggerData& triggerData, uint32_t triggerIndex);
void removeTrigger(uint32_t triggerIndex); void removeTrigger(uint32_t triggerIndex);
void focusOnTrigger(uint32_t triggerIndex); void focusOnTrigger(uint32_t triggerIndex);
void setOneShot(bool oneShot);
void getTriggerData(TriggerData& triggerData, uint32_t triggerIndex) void getTriggerData(TriggerData& triggerData, uint32_t triggerIndex)
{ {
@ -398,6 +399,27 @@ private:
{} {}
}; };
// ---------------------------------------------
class MsgScopeVisNGOneShot : public Message {
MESSAGE_CLASS_DECLARATION
public:
static MsgScopeVisNGOneShot* create(
bool oneShot)
{
return new MsgScopeVisNGOneShot(oneShot);
}
bool getOneShot() const { return m_oneShot; }
private:
bool m_oneShot;
MsgScopeVisNGOneShot(bool oneShot) :
m_oneShot(oneShot)
{}
};
// --------------------------------------------- // ---------------------------------------------
/** /**
@ -493,7 +515,6 @@ private:
{ {
TriggerUntriggered, //!< Trigger is not kicked off yet (or trigger list is empty) TriggerUntriggered, //!< Trigger is not kicked off yet (or trigger list is empty)
TriggerTriggered, //!< Trigger has been kicked off TriggerTriggered, //!< Trigger has been kicked off
TriggerWait, //!< In one shot mode trigger waits for manual re-enabling
TriggerDelay, //!< Trigger conditions have been kicked off but it is waiting for delay before final kick off TriggerDelay, //!< Trigger conditions have been kicked off but it is waiting for delay before final kick off
TriggerNewConfig, //!< Special condition when a new configuration has been received TriggerNewConfig, //!< Special condition when a new configuration has been received
}; };
@ -880,6 +901,8 @@ private:
TriggerComparator m_triggerComparator; //!< Compares sample level to trigger level TriggerComparator m_triggerComparator; //!< Compares sample level to trigger level
QMutex m_mutex; QMutex m_mutex;
Real m_projectorCache[(int) nbProjectionTypes]; Real m_projectorCache[(int) nbProjectionTypes];
bool m_triggerOneShot; //!< True when one shot mode is active
bool m_triggerWaitForReset; //!< In one shot mode suspended until reset by UI
/** /**
* Moves on to the next trigger if any or increments trigger count if in repeat mode * Moves on to the next trigger if any or increments trigger count if in repeat mode

View File

@ -754,10 +754,7 @@ void GLScopeNGGUI::on_trigColor_clicked()
void GLScopeNGGUI::on_trigOneShot_toggled(bool checked) void GLScopeNGGUI::on_trigOneShot_toggled(bool checked)
{ {
m_scopeVis->configure(m_traceLenMult*ScopeVisNG::m_traceChunkSize, m_scopeVis->setOneShot(checked);
m_timeOffset*10,
(uint32_t) (m_glScope->getTraceSize() * (ui->trigPre->value()/100.0f)),
ui->freerun->isChecked()); // TODO: implement one shot feature
} }
void GLScopeNGGUI::on_freerun_toggled(bool checked) void GLScopeNGGUI::on_freerun_toggled(bool checked)