SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ScopeVis::TriggerComparator Class Reference

Public Member Functions

 TriggerComparator ()
 
bool triggered (const Sample &s, TriggerCondition &triggerCondition)
 
void reset ()
 

Private Member Functions

void computeLevels ()
 

Private Attributes

Real m_level
 
Real m_levelPowerDB
 
Real m_levelPowerLin
 
bool m_reset
 

Detailed Description

Definition at line 1031 of file scopevis.h.

Constructor & Destructor Documentation

◆ TriggerComparator()

ScopeVis::TriggerComparator::TriggerComparator ( )
inline

Definition at line 1034 of file scopevis.h.

1034  : m_level(0), m_reset(true)
1035  {
1036  computeLevels();
1037  }

Member Function Documentation

◆ computeLevels()

void ScopeVis::TriggerComparator::computeLevels ( )
inlineprivate

Definition at line 1109 of file scopevis.h.

1110  {
1111  m_levelPowerLin = m_level + 1.0f;
1112  m_levelPowerDB = (100.0f * (m_level - 1.0f));
1113  }

◆ reset()

void ScopeVis::TriggerComparator::reset ( )
inline

Definition at line 1103 of file scopevis.h.

Referenced by ScopeVis::processTrace().

1104  {
1105  m_reset = true;
1106  }
+ Here is the caller graph for this function:

◆ triggered()

bool ScopeVis::TriggerComparator::triggered ( const Sample s,
TriggerCondition triggerCondition 
)
inline

Definition at line 1039 of file scopevis.h.

References Projector::getProjectionType(), ScopeVis::TriggerCondition::m_falses, ScopeVis::TriggerCondition::m_prevCondition, ScopeVis::TriggerCondition::m_projector, ScopeVis::TriggerData::m_triggerBothEdges, ScopeVis::TriggerCondition::m_triggerData, ScopeVis::TriggerData::m_triggerHoldoff, ScopeVis::TriggerData::m_triggerLevel, ScopeVis::TriggerData::m_triggerPositiveEdge, ScopeVis::TriggerCondition::m_trues, Projector::ProjectionMagDB, Projector::ProjectionMagLin, and Projector::run().

Referenced by ScopeVis::processTrace().

1040  {
1041  if (triggerCondition.m_triggerData.m_triggerLevel != m_level)
1042  {
1043  m_level = triggerCondition.m_triggerData.m_triggerLevel;
1044  computeLevels();
1045  }
1046 
1047  bool condition, trigger;
1048 
1049  if (triggerCondition.m_projector.getProjectionType() == Projector::ProjectionMagDB) {
1050  condition = triggerCondition.m_projector.run(s) > m_levelPowerDB;
1051  } else if (triggerCondition.m_projector.getProjectionType() == Projector::ProjectionMagLin) {
1052  condition = triggerCondition.m_projector.run(s) > m_levelPowerLin;
1053  } else {
1054  condition = triggerCondition.m_projector.run(s) > m_level;
1055  }
1056 
1057  if (condition)
1058  {
1059  if (triggerCondition.m_trues < triggerCondition.m_triggerData.m_triggerHoldoff) {
1060  condition = false;
1061  triggerCondition.m_trues++;
1062  } else {
1063  triggerCondition.m_falses = 0;
1064  }
1065  }
1066  else
1067  {
1068  if (triggerCondition.m_falses < triggerCondition.m_triggerData.m_triggerHoldoff) {
1069  condition = true;
1070  triggerCondition.m_falses++;
1071  } else {
1072  triggerCondition.m_trues = 0;
1073  }
1074  }
1075 
1076  if (m_reset)
1077  {
1078  triggerCondition.m_prevCondition = condition;
1079  m_reset = false;
1080  return false;
1081  }
1082 
1083  if (triggerCondition.m_triggerData.m_triggerBothEdges) {
1084  trigger = triggerCondition.m_prevCondition ? !condition : condition; // This is a XOR between bools
1085  } else if (triggerCondition.m_triggerData.m_triggerPositiveEdge) {
1086  trigger = !triggerCondition.m_prevCondition && condition;
1087  } else {
1088  trigger = triggerCondition.m_prevCondition && !condition;
1089  }
1090 
1091 // if (trigger) {
1092 // qDebug("ScopeVis::triggered: %s/%s %f/%f",
1093 // triggerCondition.m_prevCondition ? "T" : "F",
1094 // condition ? "T" : "F",
1095 // triggerCondition.m_projector->run(s),
1096 // triggerCondition.m_triggerData.m_triggerLevel);
1097 // }
1098 
1099  triggerCondition.m_prevCondition = condition;
1100  return trigger;
1101  }
Calculate logarithmic (dB) of squared magnitude.
Definition: projector.h:31
Calculate linear magnitude or modulus.
Definition: projector.h:29
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_level

Real ScopeVis::TriggerComparator::m_level
private

Definition at line 1115 of file scopevis.h.

◆ m_levelPowerDB

Real ScopeVis::TriggerComparator::m_levelPowerDB
private

Definition at line 1116 of file scopevis.h.

◆ m_levelPowerLin

Real ScopeVis::TriggerComparator::m_levelPowerLin
private

Definition at line 1117 of file scopevis.h.

◆ m_reset

bool ScopeVis::TriggerComparator::m_reset
private

Definition at line 1118 of file scopevis.h.


The documentation for this class was generated from the following file: