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

Commits on Aug 1, 2020

  1. Copy the full SHA
    4ef437a View commit details
  2. Copy the full SHA
    d9413b2 View commit details
Showing with 61 additions and 4 deletions.
  1. +43 −2 scopehal/ProtocolDecoder.cpp
  2. +8 −2 scopehal/TouchstoneParser.cpp
  3. +3 −0 scopehal/TouchstoneParser.h
  4. +7 −0 scopeprotocols/DeEmbedDecoder.cpp
45 changes: 43 additions & 2 deletions scopehal/ProtocolDecoder.cpp
Original file line number Diff line number Diff line change
@@ -110,10 +110,38 @@ void ProtocolDecoderParameter::ParseString(string str)
break;

case TYPE_FILENAME:
case TYPE_FILENAMES:
m_intval = 0;
m_floatval = 0;
m_filename = str;
m_filenames.push_back(str);
break;

case TYPE_FILENAMES:
{
m_intval = 0;
m_floatval = 0;
m_filename = "";

//Split out semicolon-delimited filenames
string tmp;
str += ';';
for(size_t i=0; i<str.length(); i++)
{
if(str[i] ==';')
{
if(tmp.empty())
continue;

if(m_filename == "")
m_filename = tmp;
m_filenames.push_back(tmp);
tmp = "";
continue;
}

tmp += str[i];
}
}
break;
}
}
@@ -153,10 +181,23 @@ string ProtocolDecoderParameter::ToString()
snprintf(str_out, sizeof(str_out), "%ld", m_intval);
break;
break;

case TYPE_FILENAME:
case TYPE_FILENAMES:
return m_filename;
break;

case TYPE_FILENAMES:
{
string ret = "";
for(auto f : m_filenames)
{
if(ret != "")
ret += ";";
ret += f;
}
return ret;
}
break;
}
return str_out;
}
10 changes: 8 additions & 2 deletions scopehal/TouchstoneParser.cpp
Original file line number Diff line number Diff line change
@@ -206,7 +206,6 @@ void TouchstoneParser::Clear()
bool TouchstoneParser::Load(string fname)
{
Clear();
Allocate();

//If file doesn't exist, bail early
FILE* fp = fopen(fname.c_str(), "r");
@@ -216,6 +215,8 @@ bool TouchstoneParser::Load(string fname)
return false;
}

Allocate();

//Read line by line.
char line[256];
double unit_scale = 1;
@@ -312,8 +313,13 @@ void TouchstoneParser::Allocate()
*/
TouchstoneParser& TouchstoneParser::operator *=(const TouchstoneParser& rhs)
{
//Make sure we have parameters to work with
if(rhs.empty())
{
}

//If we have no parameters, just copy whatever is there
if(m_params.empty())
else if(m_params.empty())
{
Allocate();

3 changes: 3 additions & 0 deletions scopehal/TouchstoneParser.h
Original file line number Diff line number Diff line change
@@ -94,6 +94,9 @@ class TouchstoneParser

virtual ~TouchstoneParser();

bool empty() const
{ return m_params.empty(); }

void Clear();
bool Load(std::string fname);

7 changes: 7 additions & 0 deletions scopeprotocols/DeEmbedDecoder.cpp
Original file line number Diff line number Diff line change
@@ -163,6 +163,13 @@ void DeEmbedDecoder::DoRefresh(bool invert)
m_sparams *= TouchstoneParser(f);
}

//Don't die if the file couldn't be loaded
if(m_sparams.empty())
{
SetData(NULL);
return;
}

//TODO: optimization, resample s-parameters to our sample rate once vs every waveform update

//We need meaningful data