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

Commits on Apr 30, 2021

  1. Add ATT and OFFSET for RS

    fsedano committed Apr 30, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    f96efc0 View commit details
  2. Merge pull request #436 from fsedano/add_att_offset

    Add ATT and OFFSET for RS RTM3000
    azonenberg authored Apr 30, 2021
    Copy the full SHA
    540e779 View commit details
Showing with 71 additions and 21 deletions.
  1. +69 −21 scopehal/RohdeSchwarzOscilloscope.cpp
  2. +2 −0 scopehal/RohdeSchwarzOscilloscope.h
90 changes: 69 additions & 21 deletions scopehal/RohdeSchwarzOscilloscope.cpp
Original file line number Diff line number Diff line change
@@ -138,10 +138,39 @@ RohdeSchwarzOscilloscope::RohdeSchwarzOscilloscope(SCPITransport* transport)
LogDebug("* None\n");
for(auto sopt : options)
{
LogDebug(" * %s ",sopt.c_str());
if(opt == "B243")
LogDebug("* 350 MHz bandwidth upgrade for RTM3004\n");
LogDebug("(350 MHz bandwidth upgrade for RTM3004)\n");
else if(sopt == "K1")
LogDebug("(SPI Bus)\n");
else if(sopt == "K2")
LogDebug("(UART / RS232)\n");
else if(sopt == "K3")
LogDebug("(CAN)\n");
else if(sopt == "K5")
LogDebug("(Audio signals)\n");
else if(sopt == "B1") {
// TODO add digital channels
LogDebug("(Mixed signal, 16 channels)\n");
}
else if(sopt == "K31")
LogDebug("(Power analysis)\n");
else if(sopt == "K6")
LogDebug("(MIL-1553)\n");
else if(sopt == "K7")
LogDebug("(ARINC 429)\n");
else if(sopt == "K15")
LogDebug("(History)\n");
else if(sopt == "K18")
LogDebug("(Spectrum analysis and spectrogram)\n");
else if(sopt == "B6")
LogDebug("(Signal generation)\n");
else if(sopt == "B2410")
LogDebug("(Bandwidth 1 GHz)\n");
else if(sopt == "K36")
LogDebug("(Frequency response analysis)\n");
else
LogDebug("* %s (unknown)\n", sopt.c_str());
LogDebug("(unknown)\n");
}
}

@@ -173,6 +202,7 @@ void RohdeSchwarzOscilloscope::FlushConfigCache()
m_channelVoltageRanges.clear();
m_channelsEnabled.clear();
m_channelCouplings.clear();
m_channelAttenuations.clear();

delete m_trigger;
m_trigger = NULL;
@@ -287,28 +317,29 @@ void RohdeSchwarzOscilloscope::SetChannelCoupling(size_t i, OscilloscopeChannel:
m_channelCouplings[i] = type;
}

double RohdeSchwarzOscilloscope::GetChannelAttenuation(size_t /*i*/)
double RohdeSchwarzOscilloscope::GetChannelAttenuation(size_t i)
{
/*
lock_guard<recursive_mutex> lock(m_mutex);
m_transport->SendCommand(m_channels[i]->GetHwname() + ":PROB?");
string reply = m_transport->ReadReply();
double atten;
sscanf(reply.c_str(), "%lf", &atten);
return atten;
*/

LogWarning("RohdeSchwarzOscilloscope::GetChannelAttenuation unimplemented\n");
{
lock_guard<recursive_mutex> lock(m_cacheMutex);
if(m_channelAttenuations.find(i) != m_channelAttenuations.end())
return m_channelAttenuations[i];
}
// FIXME Don't know SCPI to get this, relying on cache
return 1;
}

void RohdeSchwarzOscilloscope::SetChannelAttenuation(size_t /*i*/, double /*atten*/)
void RohdeSchwarzOscilloscope::SetChannelAttenuation(size_t i, double atten)
{
//FIXME
{
lock_guard<recursive_mutex> lock(m_cacheMutex);
m_channelAttenuations[i] = atten;
}

lock_guard<recursive_mutex> lock(m_mutex);

LogWarning("RohdeSchwarzOscilloscope::SetChannelAttenuation unimplemented\n");
char cmd[128];
snprintf(cmd, sizeof(cmd), "PROB%ld:SET:ATT:MAN ", m_channels[i]->GetIndex()+1);
PushFloat(cmd, atten);
}

int RohdeSchwarzOscilloscope::GetChannelBandwidthLimit(size_t /*i*/)
@@ -388,10 +419,17 @@ double RohdeSchwarzOscilloscope::GetChannelOffset(size_t i)
return offset;
}

void RohdeSchwarzOscilloscope::SetChannelOffset(size_t /*i*/, double /*offset*/)
void RohdeSchwarzOscilloscope::SetChannelOffset(size_t i, double offset)
{
//FIXME
LogWarning("RohdeSchwarzOscilloscope::SetChannelOffset unimplemented\n");
{
lock_guard<recursive_mutex> lock(m_cacheMutex);
m_channelOffsets[i] = offset;
}

lock_guard<recursive_mutex> lock(m_mutex);
char cmd[128];
snprintf(cmd, sizeof(cmd), "%s:OFFS %.4f", m_channels[i]->GetHwname().c_str(), -offset);
m_transport->SendCommand(cmd);
}

Oscilloscope::TriggerMode RohdeSchwarzOscilloscope::PollTrigger()
@@ -699,3 +737,13 @@ void RohdeSchwarzOscilloscope::PushEdgeTrigger(EdgeTrigger* /*trig*/ )

//TODO unimplemented
}

/**
@brief Sends float, assumes transport is already mutexed
*/

void RohdeSchwarzOscilloscope::PushFloat(string path, float f)
{
m_transport->SendCommand(path + " " + to_string_sci(f));
}

2 changes: 2 additions & 0 deletions scopehal/RohdeSchwarzOscilloscope.h
Original file line number Diff line number Diff line change
@@ -103,12 +103,14 @@ class RohdeSchwarzOscilloscope : public SCPIOscilloscope
std::map<size_t, double> m_channelVoltageRanges;
std::map<int, bool> m_channelsEnabled;
std::map<size_t, OscilloscopeChannel::CouplingType> m_channelCouplings;
std::map<size_t, double> m_channelAttenuations;

bool m_triggerArmed;
bool m_triggerOneShot;

void PullEdgeTrigger();
void PushEdgeTrigger(EdgeTrigger* trig);
void PushFloat(std::string path, float f);

public:
static std::string GetDriverNameInternal();