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: 78d10f981369
Choose a base ref
...
head repository: ngscopeclient/scopehal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 21c04bb06e4c
Choose a head ref
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on Mar 5, 2020

  1. Copy the full SHA
    21c04bb View commit details
Showing with 39 additions and 3 deletions.
  1. +39 −3 scopehal/ProtocolDecoder.cpp
42 changes: 39 additions & 3 deletions scopehal/ProtocolDecoder.cpp
Original file line number Diff line number Diff line change
@@ -555,9 +555,16 @@ void ProtocolDecoder::FindZeroCrossings(AnalogCapture* data, float threshold, st

string ProtocolDecoder::SerializeConfiguration(std::map<void*, int>& idmap, int& nextID)
{
//Name ourself
int id = nextID ++;
idmap[this] = id;
//Name ourself. Note that serialization may not be topologically sorted!
//It's possible another decoder may depend on us, and allocate an ID for us in advance
int id;
if(idmap.find(this) == idmap.end())
{
id = nextID ++;
idmap[this] = id;
}
else
id = idmap[this];

//Save basic decode info
char tmp[1024];
@@ -577,8 +584,37 @@ string ProtocolDecoder::SerializeConfiguration(std::map<void*, int>& idmap, int&
config += tmp;

//Inputs
snprintf(tmp, sizeof(tmp), " inputs: %%\n");
config += tmp;
for(size_t i=0; i<m_channels.size(); i++)
{
auto chan = m_channels[i];
if(chan == NULL)
snprintf(tmp, sizeof(tmp), " %s: 0\n", m_signalNames[i].c_str());
else
{
if(idmap.find(chan) == idmap.end())
{
id = nextID ++;
idmap[chan] = id;
}
else
id = idmap[chan];

snprintf(tmp, sizeof(tmp), " %-20s %d\n", (m_signalNames[i] + ":").c_str(), id);
}

config += tmp;
}

//Parameters
snprintf(tmp, sizeof(tmp), " parameters: %%\n");
config += tmp;
for(auto it : m_parameters)
{
snprintf(tmp, sizeof(tmp), " %-20s %s\n", (it.first+":").c_str(), it.second.ToString().c_str());
config += tmp;
}

return config;
}