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

Commits on Oct 9, 2020

  1. Copy the full SHA
    07fcec6 View commit details
  2. Oscilloscope: added Get/SetChannelDisplayName() rather than having m_…

    …displayname freely mutable. Allows for future sync of channel display names on hardware.
    azonenberg committed Oct 9, 2020
    Copy the full SHA
    d1a1fe7 View commit details
8 changes: 4 additions & 4 deletions scopehal/DemoOscilloscope.cpp
Original file line number Diff line number Diff line change
@@ -96,10 +96,10 @@ DemoOscilloscope::DemoOscilloscope(SCPITransport* transport)
m_depth = 100e3;
m_rate = 50e9;

m_channels[0]->m_displayname = "Tone";
m_channels[1]->m_displayname = "Ramp";
m_channels[2]->m_displayname = "PRBS31";
m_channels[3]->m_displayname = "8B10B";
m_channels[0]->SetDisplayName("Tone");
m_channels[1]->SetDisplayName("Ramp");
m_channels[2]->SetDisplayName("PRBS31");
m_channels[3]->SetDisplayName("8B10B");
}

DemoOscilloscope::~DemoOscilloscope()
6 changes: 3 additions & 3 deletions scopehal/FlowGraphNode.cpp
Original file line number Diff line number Diff line change
@@ -36,7 +36,7 @@ using namespace std;

string StreamDescriptor::GetName()
{
string name = m_channel->m_displayname;
string name = m_channel->GetDisplayName();
if(m_channel->GetStreamCount() > 1)
name += string(".") + m_channel->GetStreamName(m_stream);
return name;
@@ -170,7 +170,7 @@ string FlowGraphNode::GetInputDisplayName(size_t i)
{
auto in = m_inputs[i];
if(in.m_channel->GetStreamCount() > 1)
return in.m_channel->m_displayname + "." + in.m_channel->GetStreamName(in.m_stream);
return in.m_channel->GetDisplayName() + "." + in.m_channel->GetStreamName(in.m_stream);
else
return in.m_channel->m_displayname;
return in.m_channel->GetDisplayName();
}
4 changes: 2 additions & 2 deletions scopehal/LeCroyOscilloscope.cpp
Original file line number Diff line number Diff line change
@@ -1305,7 +1305,7 @@ int LeCroyOscilloscope::GetMeterChannelCount()
string LeCroyOscilloscope::GetMeterChannelName(int chan)
{
lock_guard<recursive_mutex> lock(m_mutex);
return m_channels[chan]->m_displayname;
return m_channels[chan]->GetDisplayName();
}

int LeCroyOscilloscope::GetCurrentMeterChannel()
@@ -2150,7 +2150,7 @@ map<int, DigitalWaveform*> LeCroyOscilloscope::ProcessDigitalWaveform(string& da
//See how much space we saved
/*
LogDebug("%s: %zu samples deduplicated to %zu (%.1f %%)\n",
m_digitalChannels[i]->m_displayname.c_str(),
m_digitalChannels[i]->GetDisplayName().c_str(),
num_samples,
k,
(k * 100.0f) / num_samples);
16 changes: 13 additions & 3 deletions scopehal/Oscilloscope.cpp
Original file line number Diff line number Diff line change
@@ -124,7 +124,7 @@ OscilloscopeChannel* Oscilloscope::GetChannelByDisplayName(string name)
{
for(auto c : m_channels)
{
if(c->m_displayname == name)
if(c->GetDisplayName() == name)
return c;
}
return NULL;
@@ -251,7 +251,7 @@ string Oscilloscope::SerializeConfiguration(IDTable& table)
config += tmp;
snprintf(tmp, sizeof(tmp), " color: \"%s\"\n", chan->m_displaycolor.c_str());
config += tmp;
snprintf(tmp, sizeof(tmp), " nick: \"%s\"\n", chan->m_displayname.c_str());
snprintf(tmp, sizeof(tmp), " nick: \"%s\"\n", chan->GetDisplayName().c_str());
config += tmp;
snprintf(tmp, sizeof(tmp), " name: \"%s\"\n", chan->GetHwname().c_str());
config += tmp;
@@ -335,7 +335,7 @@ void Oscilloscope::LoadConfiguration(const YAML::Node& node, IDTable& table)
//These are only needed for offline scopes to create a representation of the original instrument.

chan->m_displaycolor = cnode["color"].as<string>();
chan->m_displayname = cnode["nick"].as<string>();
chan->SetDisplayName(cnode["nick"].as<string>());

if(cnode["enabled"].as<int>())
chan->Enable();
@@ -402,6 +402,16 @@ bool Oscilloscope::CanInterleave()
return true;
}

void Oscilloscope::SetChannelDisplayName(size_t i, string name)
{
m_channelDisplayNames[m_channels[i]] = name;
}

string Oscilloscope::GetChannelDisplayName(size_t i)
{
return m_channelDisplayNames[m_channels[i]];
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Logic analyzer configuration (default no-op for scopes without MSO feature)

30 changes: 30 additions & 0 deletions scopehal/Oscilloscope.h
Original file line number Diff line number Diff line change
@@ -155,6 +155,33 @@ class Oscilloscope : public virtual Instrument
*/
virtual void SetChannelCoupling(size_t i, OscilloscopeChannel::CouplingType type) =0;

/**
@brief Gets the display name for a channel. This is an arbitrary user-selected string.
Some instruments allow displaying channel names in the GUI or on probes. If this is supported, the
driver should override this function.
The default function simply stores the display name in the Oscilloscope object, and is appropriate for
instruments which have no concept of a nickname or display name.
@param i Zero-based index of channel
*/
virtual std::string GetChannelDisplayName(size_t i);

/**
@brief Sets the display name for a channel. This is an arbitrary user-selected string.
Some instruments allow displaying channel names in the GUI or on probes. If this is supported, the
driver should override this function.
The default function simply stores the display name in the Oscilloscope object, and is appropriate for
instruments which have no concept of a nickname or display name.
@param i Zero-based index of channel
@param name Name of the channel
*/
virtual void SetChannelDisplayName(size_t i, std::string name);

/**
@brief Gets the probe attenuation for an input channel.
@@ -619,6 +646,9 @@ class Oscilloscope : public virtual Instrument
///The channels
std::vector<OscilloscopeChannel*> m_channels;

///Display names for channels
std::map<OscilloscopeChannel*, std::string> m_channelDisplayNames;

//The trigger
Trigger* m_trigger;

16 changes: 16 additions & 0 deletions scopehal/OscilloscopeChannel.cpp
Original file line number Diff line number Diff line change
@@ -241,6 +241,22 @@ void OscilloscopeChannel::SetCenterFrequency(int64_t freq)
m_scope->SetCenterFrequency(m_index, freq);
}

void OscilloscopeChannel::SetDisplayName(string name)
{
if(m_scope)
m_scope->SetChannelDisplayName(m_index, name);
else
m_displayname = name;
}

string OscilloscopeChannel::GetDisplayName()
{
if(m_scope)
return m_scope->GetChannelDisplayName(m_index);
else
return m_displayname;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Accessors

21 changes: 17 additions & 4 deletions scopehal/OscilloscopeChannel.h
Original file line number Diff line number Diff line change
@@ -83,9 +83,6 @@ class OscilloscopeChannel
///Display color (any valid GDK format)
std::string m_displaycolor;

///Display name (user defined, defaults to m_hwname)
std::string m_displayname;

//Stuff here is set once at init and can't be changed
ChannelType GetType()
{ return m_type; }
@@ -132,6 +129,9 @@ class OscilloscopeChannel
size_t GetRefCount()
{ return m_refcount; }

void SetDisplayName(std::string name);
std::string GetDisplayName();

//Hardware configuration
public:
bool IsEnabled();
@@ -140,7 +140,8 @@ class OscilloscopeChannel
void Enable();
void Disable();

//These functions are preferred in GUI or other environments with multiple loads
//These functions are preferred in GUI or other environments with multiple consumers of waveform data.
//The channel is reference counted and only turned off when all consumers have released it.
virtual void AddRef();
virtual void Release();

@@ -205,6 +206,18 @@ class OscilloscopeChannel
m_streamData.push_back(NULL);
}

/**
@brief Display name (user defined, defaults to m_hwname)
This is ONLY used if m_scope is NULL.
*/
std::string m_displayname;

/**
@brief The oscilloscope (if any) we are part of.
Note that filters and other special channels are not attached to a scope.
*/
Oscilloscope* m_scope;

///Channel type
2 changes: 1 addition & 1 deletion scopeprotocols/SDCmdDecoder.cpp
Original file line number Diff line number Diff line change
@@ -450,7 +450,7 @@ string SDCmdDecoder::GetText(int i)
case 3: return "SEND_RELATIVE_ADDR";
case 4: return "SET_DSR";
//CMD5 reserved for SDIO
case 6: return "SWITCH_FUNC";
case 6: return "SET_BUS_WIDTH";
case 7: return "SELECT_DESELECT_CARD";
case 8: return "SEND_IF_COND";
case 9: return "SEND_CSD";