Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ngscopeclient/scopehal
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 78c31760626b
Choose a base ref
...
head repository: ngscopeclient/scopehal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 9829b03db32b
Choose a head ref
  • 1 commit
  • 2 files changed
  • 1 contributor

Commits on Oct 30, 2020

  1. Copy the full SHA
    9829b03 View commit details
Showing with 33 additions and 1 deletion.
  1. +25 −1 scopeprotocols/EyePattern.cpp
  2. +8 −0 scopeprotocols/EyePattern.h
26 changes: 25 additions & 1 deletion scopeprotocols/EyePattern.cpp
Original file line number Diff line number Diff line change
@@ -95,12 +95,14 @@ EyePattern::EyePattern(const string& color)
, m_width(1)
, m_xoff(0)
, m_xscale(0)
, m_lastClockAlign(ALIGN_CENTER)
, m_saturationName("Saturation Level")
, m_centerName("Center Voltage")
, m_maskName("Mask")
, m_polarityName("Clock Edge")
, m_vmodeName("Vertical Scale Mode")
, m_rangeName("Vertical Range")
, m_clockAlignName("Clock Alignment")
{
//Set up channels
CreateInput("din");
@@ -129,6 +131,11 @@ EyePattern::EyePattern(const string& color)

m_parameters[m_rangeName] = FilterParameter(FilterParameter::TYPE_FLOAT, Unit(Unit::UNIT_VOLTS));
m_parameters[m_rangeName].SetFloatVal(0.25);

m_parameters[m_clockAlignName] = FilterParameter(FilterParameter::TYPE_ENUM, Unit(Unit::UNIT_COUNTS));
m_parameters[m_clockAlignName].AddEnumValue("Center", ALIGN_CENTER);
m_parameters[m_clockAlignName].AddEnumValue("Edge", ALIGN_EDGE);
m_parameters[m_clockAlignName].SetIntVal(ALIGN_CENTER);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -369,11 +376,20 @@ void EyePattern::Refresh()
{
if(abs(cap->GetCenterVoltage() - center) > 0.001)
{
delete cap;
SetData(NULL, 0);
cap = NULL;
}
}

//If clock alignment was changed, reset existing eye data
ClockAlignment clock_align = static_cast<ClockAlignment>(m_parameters[m_clockAlignName].GetIntVal());
if(m_lastClockAlign != clock_align)
{
SetData(NULL, 0);
cap = NULL;
m_lastClockAlign = clock_align;
}

//Load the mask, if needed
string maskpath = m_parameters[m_maskName].GetFileName();
if(maskpath != m_mask.GetFileName())
@@ -407,6 +423,14 @@ void EyePattern::Refresh()
if(cap->m_uiWidth < FLT_EPSILON)
RecalculateUIWidth();

//Shift the clock by half a UI if it's edge aligned
//All of the eye creation logic assumes a center aligned clock.
if(clock_align == ALIGN_EDGE)
{
for(size_t i=0; i<clock_edges.size(); i++)
clock_edges[i] += cap->m_uiWidth / 2;
}

//Process the eye
size_t cend = clock_edges.size();
float yscale = m_height / GetVoltageRange();
8 changes: 8 additions & 0 deletions scopeprotocols/EyePattern.h
Original file line number Diff line number Diff line change
@@ -164,6 +164,12 @@ class EyePattern : public Filter
RANGE_FIXED = 1
};

enum ClockAlignment
{
ALIGN_CENTER,
ALIGN_EDGE
};

PROTOCOL_DECODER_INITPROC(EyePattern)

protected:
@@ -174,13 +180,15 @@ class EyePattern : public Filter

int64_t m_xoff;
float m_xscale;
ClockAlignment m_lastClockAlign;

std::string m_saturationName;
std::string m_centerName;
std::string m_maskName;
std::string m_polarityName;
std::string m_vmodeName;
std::string m_rangeName;
std::string m_clockAlignName;

EyeMask m_mask;
};