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

Commits on Sep 27, 2020

  1. TektronixOscilloscope: create digital channels for each flex channel.…

    … Automatically disabled if no LA probe is connected, but no proper on/off support yet. See #264.
    azonenberg committed Sep 27, 2020
    Copy the full SHA
    41ff1e0 View commit details
  2. Copy the full SHA
    583b909 View commit details
Showing with 81 additions and 5 deletions.
  1. +78 −5 scopehal/TektronixOscilloscope.cpp
  2. +3 −0 scopehal/TektronixOscilloscope.h
83 changes: 78 additions & 5 deletions scopehal/TektronixOscilloscope.cpp
Original file line number Diff line number Diff line change
@@ -170,6 +170,35 @@ TektronixOscilloscope::TektronixOscilloscope(SCPITransport* transport)
break;
}

//Add all possible digital channels
switch(m_family)
{
case FAMILY_MSO5:
case FAMILY_MSO6:
for(size_t i=0; i<m_analogChannelCount; i++)
{
for(size_t j=0; j<8; j++)
{
//TODO: pick colors properly
auto chan = new OscilloscopeChannel(
this,
m_channels[i]->GetHwname() + "_D" + to_string(j),
OscilloscopeChannel::CHANNEL_TYPE_DIGITAL,
m_channels[i]->m_displaycolor,
1,
m_channels.size(),
true);

m_flexChannelParents[chan] = i;
m_channels.push_back(chan);
}
}
break;

default:
break;
}

//See what options we have
vector<string> options;
/*
@@ -295,10 +324,23 @@ bool TektronixOscilloscope::IsChannelEnabled(size_t i)
if(i == m_extTrigChannel->GetIndex())
return false;

//Ignore digital channels for now
//Digital channels
if(i >= m_analogChannelCount)
return false;
{
lock_guard<recursive_mutex> lock(m_cacheMutex);

//If the parent analog channel doesn't have a digital probe, we're disabled
size_t parent = m_flexChannelParents[m_channels[i]];
if(m_probeTypes[parent] != PROBE_TYPE_DIGITAL_8BIT)
return false;

//Check the cache
if(m_channelsEnabled.find(i) != m_channelsEnabled.end())
return m_channelsEnabled[i];
}

//Analog channels
else
{
lock_guard<recursive_mutex> lock(m_cacheMutex);

@@ -313,7 +355,7 @@ bool TektronixOscilloscope::IsChannelEnabled(size_t i)

lock_guard<recursive_mutex> lock2(m_mutex);

m_transport->SendCommand(string("DISP:GLOB:") + m_channels[i]->GetHwname() + ":STATE?");
m_transport->SendCommand(string("DISP:WAVEV:") + m_channels[i]->GetHwname() + ":STATE?");
string reply = m_transport->ReadReply();

if(reply == "0")
@@ -340,7 +382,7 @@ void TektronixOscilloscope::EnableChannel(size_t i)

{
lock_guard<recursive_mutex> lock(m_mutex);
m_transport->SendCommand(string("DISP:GLOB:") + m_channels[i]->GetHwname() + ":STATE ON");
m_transport->SendCommand(string("DISP:WAVEV:") + m_channels[i]->GetHwname() + ":STATE ON");
}

lock_guard<recursive_mutex> lock2(m_cacheMutex);
@@ -359,7 +401,7 @@ void TektronixOscilloscope::DisableChannel(size_t i)

{
lock_guard<recursive_mutex> lock(m_mutex);
m_transport->SendCommand(string("DISP:GLOB:") + m_channels[i]->GetHwname() + ":STATE OFF");
m_transport->SendCommand(string("DISP:WAVEV:") + m_channels[i]->GetHwname() + ":STATE OFF");
}

lock_guard<recursive_mutex> lock2(m_cacheMutex);
@@ -375,6 +417,10 @@ OscilloscopeChannel::CouplingType TektronixOscilloscope::GetChannelCoupling(size
return m_channelCouplings[i];
}

//If not analog, return default
if(i >= m_analogChannelCount)
return OscilloscopeChannel::COUPLE_DC_50;

OscilloscopeChannel::CouplingType coupling = OscilloscopeChannel::COUPLE_DC_1M;
{
lock_guard<recursive_mutex> lock2(m_mutex);
@@ -501,6 +547,10 @@ double TektronixOscilloscope::GetChannelAttenuation(size_t i)
return m_channelAttenuations[i];
}

//If not analog, return default
if(i >= m_analogChannelCount)
return 1;

lock_guard<recursive_mutex> lock(m_mutex);

switch(m_family)
@@ -581,6 +631,10 @@ int TektronixOscilloscope::GetChannelBandwidthLimit(size_t i)
return m_channelBandwidthLimits[i];
}

//If not analog, return default
if(i >= m_analogChannelCount)
return 0;

int bwl = 0;
{
lock_guard<recursive_mutex> lock(m_mutex);
@@ -655,12 +709,17 @@ void TektronixOscilloscope::SetChannelBandwidthLimit(size_t i, unsigned int limi

double TektronixOscilloscope::GetChannelVoltageRange(size_t i)
{
//Check cache
{
lock_guard<recursive_mutex> lock(m_cacheMutex);
if(m_channelVoltageRanges.find(i) != m_channelVoltageRanges.end())
return m_channelVoltageRanges[i];
}

//If not analog, return a placeholder value
if(i > m_analogChannelCount)
return 1;

//We want total range, not per division
double range;
{
@@ -682,6 +741,10 @@ void TektronixOscilloscope::SetChannelVoltageRange(size_t i, double range)
m_channelVoltageRanges[i] = range;
}

//If not analog, skip it
if(i > m_analogChannelCount)
return;

lock_guard<recursive_mutex> lock(m_mutex);

switch(m_family)
@@ -710,6 +773,10 @@ double TektronixOscilloscope::GetChannelOffset(size_t i)
return m_channelOffsets[i];
}

//If not analog, return a placeholder value
if(i > m_analogChannelCount)
return 0;

//Read offset
double offset;
{
@@ -733,6 +800,10 @@ void TektronixOscilloscope::SetChannelOffset(size_t i, double offset)
m_channelOffsets[i] = offset;
}

//If not analog, skip it
if(i > m_analogChannelCount)
return;

lock_guard<recursive_mutex> lock(m_mutex);

switch(m_family)
@@ -947,6 +1018,8 @@ bool TektronixOscilloscope::AcquireDataMSO56(map<int, vector<AnalogWaveform*> >&
m_channelOffsets[i] = -yoffs[i];
//LogDebug("yoff = %s\n", Unit(Unit::UNIT_VOLTS).PrettyPrint(yoff).c_str());
}

//TODO: xzero is trigger time
}
}

3 changes: 3 additions & 0 deletions scopehal/TektronixOscilloscope.h
Original file line number Diff line number Diff line change
@@ -146,6 +146,9 @@ class TektronixOscilloscope : public SCPIOscilloscope
std::map<size_t, int64_t> m_channelDeskew;
std::map<size_t, ProbeType> m_probeTypes;

///The analog channel for each flex channel
std::map<OscilloscopeChannel*, size_t> m_flexChannelParents;

bool m_triggerArmed;
bool m_triggerOneShot;