1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 10:05:46 -05:00

Scope: implemented a fixed trigger holdoff of 2 samples

This commit is contained in:
f4exb 2018-10-27 23:16:56 +02:00
parent f142c98e82
commit d17df4690a

View File

@ -1021,7 +1021,7 @@ private:
class TriggerComparator class TriggerComparator
{ {
public: public:
TriggerComparator() : m_level(0), m_reset(true) TriggerComparator() : m_level(0), m_reset(true), m_holdoff(2), m_trues(0), m_falses(0)
{ {
computeLevels(); computeLevels();
} }
@ -1044,6 +1044,25 @@ private:
condition = triggerCondition.m_projector.run(s) > m_level; condition = triggerCondition.m_projector.run(s) > m_level;
} }
if (condition)
{
if (m_trues < m_holdoff) {
condition = false;
m_trues++;
} else {
m_falses = 0;
}
}
else
{
if (m_falses < m_holdoff) {
condition = true;
m_falses++;
} else {
m_trues = 0;
}
}
if (m_reset) if (m_reset)
{ {
triggerCondition.m_prevCondition = condition; triggerCondition.m_prevCondition = condition;
@ -1087,6 +1106,9 @@ private:
Real m_levelPowerDB; Real m_levelPowerDB;
Real m_levelPowerLin; Real m_levelPowerLin;
bool m_reset; bool m_reset;
uint32_t m_holdoff;
uint32_t m_trues;
uint32_t m_falses;
}; };
GLScope* m_glScope; GLScope* m_glScope;