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

Commits on Apr 29, 2021

  1. Copy the full SHA
    f4264ba View commit details
  2. Merge pull request #434 from fsedano/cache_rs_coup

    Add cache to COUP on RS scopes, fix wrong COUP response
    azonenberg authored Apr 29, 2021
    Copy the full SHA
    e930f20 View commit details
Showing with 46 additions and 27 deletions.
  1. +45 −27 scopehal/RohdeSchwarzOscilloscope.cpp
  2. +1 −0 scopehal/RohdeSchwarzOscilloscope.h
72 changes: 45 additions & 27 deletions scopehal/RohdeSchwarzOscilloscope.cpp
Original file line number Diff line number Diff line change
@@ -172,6 +172,7 @@ void RohdeSchwarzOscilloscope::FlushConfigCache()
m_channelOffsets.clear();
m_channelVoltageRanges.clear();
m_channelsEnabled.clear();
m_channelCouplings.clear();

delete m_trigger;
m_trigger = NULL;
@@ -222,51 +223,68 @@ void RohdeSchwarzOscilloscope::DisableChannel(size_t i)

OscilloscopeChannel::CouplingType RohdeSchwarzOscilloscope::GetChannelCoupling(size_t i)
{
lock_guard<recursive_mutex> lock(m_mutex);
{
lock_guard<recursive_mutex> lock(m_cacheMutex);
if(m_channelCouplings.find(i) != m_channelCouplings.end())
return m_channelCouplings[i];
}

m_transport->SendCommand(m_channels[i]->GetHwname() + ":COUP?");
string reply = m_transport->ReadReply();
string reply;
{
lock_guard<recursive_mutex> lock(m_mutex);

if(reply == "ACLimit")
return OscilloscopeChannel::COUPLE_AC_1M;
else if(reply == "DCLimit")
return OscilloscopeChannel::COUPLE_DC_1M;
m_transport->SendCommand(m_channels[i]->GetHwname() + ":COUP?");
reply = m_transport->ReadReply();
}
OscilloscopeChannel::CouplingType coupling;

if(reply == "ACLimit" || reply == "ACL")
coupling = OscilloscopeChannel::COUPLE_AC_1M;
else if(reply == "DCLimit" || reply == "DCL")
coupling = OscilloscopeChannel::COUPLE_DC_1M;
else if(reply == "GND")
return OscilloscopeChannel::COUPLE_GND;
coupling = OscilloscopeChannel::COUPLE_GND;
else if(reply == "DC")
return OscilloscopeChannel::COUPLE_DC_50;

coupling = OscilloscopeChannel::COUPLE_DC_50;
else
{
LogWarning("invalid coupling value\n");
return OscilloscopeChannel::COUPLE_DC_50;
coupling = OscilloscopeChannel::COUPLE_DC_50;
}

lock_guard<recursive_mutex> lock(m_cacheMutex);
m_channelCouplings[i] = coupling;
return coupling;
}

void RohdeSchwarzOscilloscope::SetChannelCoupling(size_t i, OscilloscopeChannel::CouplingType type)
{
lock_guard<recursive_mutex> lock(m_mutex);
switch(type)
{
case OscilloscopeChannel::COUPLE_DC_50:
m_transport->SendCommand(m_channels[i]->GetHwname() + ":COUP DC");
break;
lock_guard<recursive_mutex> lock(m_mutex);
switch(type)
{
case OscilloscopeChannel::COUPLE_DC_50:
m_transport->SendCommand(m_channels[i]->GetHwname() + ":COUP DC");
break;

case OscilloscopeChannel::COUPLE_AC_1M:
m_transport->SendCommand(m_channels[i]->GetHwname() + ":COUP ACLimit");
break;
case OscilloscopeChannel::COUPLE_AC_1M:
m_transport->SendCommand(m_channels[i]->GetHwname() + ":COUP ACLimit");
break;

case OscilloscopeChannel::COUPLE_DC_1M:
m_transport->SendCommand(m_channels[i]->GetHwname() + ":COUP DCLimit");
break;
case OscilloscopeChannel::COUPLE_DC_1M:
m_transport->SendCommand(m_channels[i]->GetHwname() + ":COUP DCLimit");
break;

case OscilloscopeChannel::COUPLE_GND:
m_transport->SendCommand(m_channels[i]->GetHwname() + ":COUP GND");
break;
case OscilloscopeChannel::COUPLE_GND:
m_transport->SendCommand(m_channels[i]->GetHwname() + ":COUP GND");
break;

default:
LogError("Invalid coupling for channel\n");
default:
LogError("Invalid coupling for channel\n");
}
}
lock_guard<recursive_mutex> lock(m_cacheMutex);
m_channelCouplings[i] = type;
}

double RohdeSchwarzOscilloscope::GetChannelAttenuation(size_t /*i*/)
1 change: 1 addition & 0 deletions scopehal/RohdeSchwarzOscilloscope.h
Original file line number Diff line number Diff line change
@@ -102,6 +102,7 @@ class RohdeSchwarzOscilloscope : public SCPIOscilloscope
std::map<size_t, double> m_channelOffsets;
std::map<size_t, double> m_channelVoltageRanges;
std::map<int, bool> m_channelsEnabled;
std::map<size_t, OscilloscopeChannel::CouplingType> m_channelCouplings;

bool m_triggerArmed;
bool m_triggerOneShot;