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: ac74973c659f
Choose a base ref
...
head repository: ngscopeclient/scopehal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 87e95b346dc0
Choose a head ref
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on May 15, 2019

  1. Copy the full SHA
    87e95b3 View commit details
Showing with 22 additions and 38 deletions.
  1. +22 −38 scopehal/LeCroyOscilloscope.cpp
60 changes: 22 additions & 38 deletions scopehal/LeCroyOscilloscope.cpp
Original file line number Diff line number Diff line change
@@ -153,44 +153,23 @@ void LeCroyOscilloscope::DetectOptions()
LogDebug("* MSXX (logic analyzer)\n");
LogIndenter li;

//Only add the channels if we're showing them
//TODO: better way of doing this!!!
SendCommand("WAVEFORM_SETUP SP,0,NP,0,FP,0,SN,0");
SendCommand("Digital1:WF?");
string data;
if(!ReadWaveformBlock(data))
return;
if(data == "")
{
LogDebug("No logic analyzer probe connected\n");
continue;
}
string tmp = data.substr(data.find("SelectedLines=") + 14);
tmp = tmp.substr(0, 16);
if(tmp == "0000000000000000")
{
LogDebug("No digital channels enabled\n");
//TODO: allow turning them on/off dynamically
}
//TODO: send command to enable all digital channels if we use any?

else
m_digitalChannelCount = 16;

char chn[8];
for(int i=0; i<16; i++)
{
m_digitalChannelCount = 16;

char chn[8];
for(int i=0; i<16; i++)
{
snprintf(chn, sizeof(chn), "D%d", i);
auto chan = new OscilloscopeChannel(
this,
chn,
OscilloscopeChannel::CHANNEL_TYPE_DIGITAL,
GetDefaultChannelColor(m_channels.size()),
1,
m_channels.size());
m_channels.push_back(chan);
m_digitalChannels.push_back(chan);
}
snprintf(chn, sizeof(chn), "D%d", i);
auto chan = new OscilloscopeChannel(
this,
chn,
OscilloscopeChannel::CHANNEL_TYPE_DIGITAL,
GetDefaultChannelColor(m_channels.size()),
1,
m_channels.size());
m_channels.push_back(chan);
m_digitalChannels.push_back(chan);
}
}

@@ -377,7 +356,9 @@ bool LeCroyOscilloscope::IsChannelEnabled(size_t i)

void LeCroyOscilloscope::EnableChannel(size_t i)
{
//LogDebug("enable channel %d\n", i);
lock_guard<recursive_mutex> lock(m_mutex);
//LogDebug("got mutex\n");
SendCommand(m_channels[i]->GetHwname() + ":TRACE ON");
}

@@ -779,13 +760,14 @@ bool LeCroyOscilloscope::IsTriggerArmed()

Oscilloscope::TriggerMode LeCroyOscilloscope::PollTrigger()
{
lock_guard<recursive_mutex> lock(m_mutex);

//LogDebug("Polling trigger\n");

//Read the Internal State Change Register
m_mutex.lock();
SendCommand("INR?");
string sinr = ReadSingleBlockString();
m_mutex.unlock();
//LogDebug("Got trigger state\n");
int inr = atoi(sinr.c_str());

//See if we got a waveform
@@ -877,6 +859,7 @@ void LeCroyOscilloscope::BulkCheckChannelEnableState()

bool LeCroyOscilloscope::AcquireData(bool toQueue)
{
//LogDebug("acquire\n");
m_mutex.lock();

//LogDebug("Acquire data\n");
@@ -1048,6 +1031,7 @@ bool LeCroyOscilloscope::AcquireData(bool toQueue)
}
}

//LogDebug("unlock mutex\n");
m_mutex.unlock();

//Now that we have all of the pending waveforms, save them in sets across all channels