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

Commits on Nov 21, 2020

  1. Copy the full SHA
    5019815 View commit details
  2. Copy the full SHA
    d0e4f58 View commit details
Showing with 30 additions and 3 deletions.
  1. +29 −3 scopehal/LeCroyOscilloscope.cpp
  2. +1 −0 scopehal/LeCroyOscilloscope.h
32 changes: 29 additions & 3 deletions scopehal/LeCroyOscilloscope.cpp
Original file line number Diff line number Diff line change
@@ -893,6 +893,7 @@ void LeCroyOscilloscope::FlushConfigCache()
m_channelsEnabled.clear();
m_channelDeskew.clear();
m_channelDisplayNames.clear();
m_probeIsActive.clear();
m_sampleRateValid = false;
m_memoryDepthValid = false;
m_triggerOffsetValid = false;
@@ -1142,10 +1143,15 @@ OscilloscopeChannel::CouplingType LeCroyOscilloscope::GetChannelCoupling(size_t
if(i >= m_analogChannelCount)
return OscilloscopeChannel::COUPLE_SYNTHETIC;

lock_guard<recursive_mutex> lock(m_mutex);
string reply;
{
lock_guard<recursive_mutex> lock(m_mutex);
m_transport->SendCommand(m_channels[i]->GetHwname() + ":COUPLING?");
reply = Trim(m_transport->ReadReply().substr(0,3));
}

m_transport->SendCommand(m_channels[i]->GetHwname() + ":COUPLING?");
string reply = m_transport->ReadReply().substr(0,3); //trim off trailing newline, all coupling codes are 3 chars
lock_guard<recursive_mutex> lock2(m_cacheMutex);
m_probeIsActive[i] = false;

if(reply == "A1M")
return OscilloscopeChannel::COUPLE_AC_1M;
@@ -1155,6 +1161,11 @@ OscilloscopeChannel::CouplingType LeCroyOscilloscope::GetChannelCoupling(size_t
return OscilloscopeChannel::COUPLE_DC_50;
else if(reply == "GND")
return OscilloscopeChannel::COUPLE_GND;
else if(reply == "DC")
{
m_probeIsActive[i] = true;
return OscilloscopeChannel::COUPLE_DC_50;
}

//invalid
LogWarning("LeCroyOscilloscope::GetChannelCoupling got invalid coupling %s\n", reply.c_str());
@@ -1166,6 +1177,14 @@ void LeCroyOscilloscope::SetChannelCoupling(size_t i, OscilloscopeChannel::Coupl
if(i >= m_analogChannelCount)
return;

//Get the old coupling value first.
//This ensures that m_probeIsActive[i] is valid
GetChannelCoupling(i);

//If we have an active probe, don't touch the hardware config
if(m_probeIsActive[i])
return;

lock_guard<recursive_mutex> lock(m_mutex);
switch(type)
{
@@ -1213,6 +1232,13 @@ void LeCroyOscilloscope::SetChannelAttenuation(size_t i, double atten)
if(i >= m_analogChannelCount)
return;

//Don't allow changing attenuation on active probes
{
lock_guard<recursive_mutex> lock(m_cacheMutex);
if(m_probeIsActive[i])
return;
}

char cmd[128];
snprintf(cmd, sizeof(cmd), "%s:ATTENUATION %f", m_channels[i]->GetHwname().c_str(), atten);

1 change: 1 addition & 0 deletions scopehal/LeCroyOscilloscope.h
Original file line number Diff line number Diff line change
@@ -310,6 +310,7 @@ class LeCroyOscilloscope
bool m_interleavingValid;
Multimeter::MeasurementTypes m_meterMode;
bool m_meterModeValid;
std::map<size_t, bool> m_probeIsActive;

//True if we have >8 bit capture depth
bool m_highDefinition;