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: 6b8456f3744c
Choose a base ref
...
head repository: ngscopeclient/scopehal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 995c6eb43d0e
Choose a head ref
  • 1 commit
  • 4 files changed
  • 1 contributor

Commits on Sep 8, 2020

  1. ClockRecoveryFilter: fixed regression causing filter to not work unle…

    …ss gating signal was connected
    azonenberg committed Sep 8, 2020
    Copy the full SHA
    995c6eb View commit details
Showing with 39 additions and 15 deletions.
  1. +24 −11 scopehal/Filter.cpp
  2. +12 −2 scopehal/Filter.h
  3. +1 −1 scopehal/Unit.cpp
  4. +2 −1 scopeprotocols/ClockRecoveryFilter.cpp
35 changes: 24 additions & 11 deletions scopehal/Filter.cpp
Original file line number Diff line number Diff line change
@@ -441,24 +441,37 @@ Filter* Filter::CreateFilter(string protocol, string color)
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Input verification helpers

/**
@brief Returns true if a given input to the filter is non-NULL (and, optionally has a non-empty waveform present)
*/
bool Filter::VerifyInputOK(size_t i, bool allowEmpty)
{
auto p = m_inputs[i];

if(p.m_channel == NULL)
return false;
auto data = p.GetData();
if(data == NULL)
return false;

if(!allowEmpty)
{
if(data->m_offsets.size() == 0)
return false;
}

return true;
}

/**
@brief Returns true if every input to the filter is non-NULL (and, optionally has a non-empty waveform present)
*/
bool Filter::VerifyAllInputsOK(bool allowEmpty)
{
for(auto p : m_inputs)
for(size_t i=0; i<m_inputs.size(); i++)
{
if(p.m_channel == NULL)
if(!VerifyInputOK(i, allowEmpty))
return false;
auto data = p.m_channel->GetData(p.m_stream);
if(data == NULL)
return false;

if(!allowEmpty)
{
if(data->m_offsets.size() == 0)
return false;
}
}

return true;
14 changes: 12 additions & 2 deletions scopehal/Filter.h
Original file line number Diff line number Diff line change
@@ -269,11 +269,21 @@ class Filter : public OscilloscopeChannel
bool m_dirty;

bool VerifyAllInputsOK(bool allowEmpty = false);
bool VerifyInputOK(size_t i, bool allowEmpty = false);
bool VerifyAllInputsOKAndAnalog();

///Gets the waveform attached to the specified input
/**
@brief Gets the waveform attached to the specified input.
This function is safe to call on a NULL input and will return NULL in that case.
*/
WaveformBase* GetInputWaveform(size_t i)
{ return m_inputs[i].m_channel->GetData(m_inputs[i].m_stream); }
{
auto chan = m_inputs[i].m_channel;
if(chan == NULL)
return NULL;
return chan->GetData(m_inputs[i].m_stream);
}

///Gets the analog waveform attached to the specified input
AnalogWaveform* GetAnalogInputWaveform(size_t i)
2 changes: 1 addition & 1 deletion scopehal/Unit.cpp
Original file line number Diff line number Diff line change
@@ -194,7 +194,7 @@ string Unit::PrettyPrint(double value)
break;

default:
snprintf(tmp, sizeof(tmp), "%.3f %s%s", value_rescaled, scale, unit);
snprintf(tmp, sizeof(tmp), "%.4f %s%s", value_rescaled, scale, unit);
break;
}
return string(tmp);
3 changes: 2 additions & 1 deletion scopeprotocols/ClockRecoveryFilter.cpp
Original file line number Diff line number Diff line change
@@ -119,7 +119,8 @@ double ClockRecoveryFilter::GetVoltageRange()

void ClockRecoveryFilter::Refresh()
{
if(!VerifyAllInputsOK())
//Require a data signal, but not necessarily a gate
if(!VerifyInputOK(0))
{
SetData(NULL, 0);
return;