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

Commits on May 7, 2019

  1. acquire data work

    four0four committed May 7, 2019
    Copy the full SHA
    62a3963 View commit details
Showing with 50 additions and 58 deletions.
  1. +47 −52 scopehal/LeCroyOscilloscope.cpp
  2. +3 −6 scopehal/SiglentSCPIOscilloscope.cpp
99 changes: 47 additions & 52 deletions scopehal/LeCroyOscilloscope.cpp
Original file line number Diff line number Diff line change
@@ -65,54 +65,7 @@ void LeCroyOscilloscope::SharedCtorInit()
true);
m_channels.push_back(m_extTrigChannel);

//Desired format for waveform data
//Only use increased bit depth if the scope actually puts content there!
if(m_highDefinition)
SendCommand("COMM_FORMAT DEF9,WORD,BIN");
else
SendCommand("COMM_FORMAT DEF9,BYTE,BIN");

//Clear the state-change register to we get rid of any history we don't care about
PollTrigger();
}

void LeCroyOscilloscope::IdentifyHardware()
{
//Turn off headers (complicate parsing and add fluff to the packets)
SendCommand("CHDR OFF", true);

//Ask for the ID
SendCommand("*IDN?", true);
string reply = ReadSingleBlockString();
char vendor[128] = "";
char model[128] = "";
char serial[128] = "";
char version[128] = "";
if(4 != sscanf(reply.c_str(), "%127[^,],%127[^,],%127[^,],%127s", vendor, model, serial, version))
{
LogError("Bad IDN response %s\n", reply.c_str());
return;
}
m_vendor = vendor;
m_model = model;
m_serial = serial;
m_fwVersion = version;

//Look up model info
if(m_model.find("WS3") == 0)
m_modelid = MODEL_WAVESURFER_3K;
else if(m_model.find("WAVERUNNER8") == 0)
m_modelid = MODEL_WAVERUNNER_8K;
else
m_modelid = MODEL_UNKNOWN;

//TODO: better way of doing this?
if(m_model.find("HD") != string::npos)
m_highDefinition = true;
}

void LeCroyOscilloscope::DetectOptions()
{
//Look at options and see if we have digital channels too
SendCommand("*OPT?", true);
string reply = ReadSingleBlockString(true);
if(reply.length() > 3)
@@ -221,6 +174,51 @@ void LeCroyOscilloscope::DetectOptions()
LogDebug("* %s (not yet implemented)\n", o.c_str());
}
}

//Desired format for waveform data
//Only use increased bit depth if the scope actually puts content there!
if(m_highDefinition)
SendCommand("COMM_FORMAT DEF9,WORD,BIN");
else
SendCommand("COMM_FORMAT DEF9,BYTE,BIN");

//Clear the state-change register to we get rid of any history we don't care about
PollTrigger();
}

void LeCroyOscilloscope::IdentifyHardware()
{
//Turn off headers (complicate parsing and add fluff to the packets)
SendCommand("CHDR OFF", true);

//Ask for the ID
SendCommand("*IDN?", true);
string reply = ReadSingleBlockString();
char vendor[128] = "";
char model[128] = "";
char serial[128] = "";
char version[128] = "";
if(4 != sscanf(reply.c_str(), "%127[^,],%127[^,],%127[^,],%127s", vendor, model, serial, version))
{
LogError("Bad IDN response %s\n", reply.c_str());
return;
}
m_vendor = vendor;
m_model = model;
m_serial = serial;
m_fwVersion = version;

//Look up model info
if(m_model.find("WS3") == 0)
m_modelid = MODEL_WAVESURFER_3K;
else if(m_model.find("WAVERUNNER8") == 0)
m_modelid = MODEL_WAVERUNNER_8K;
else
m_modelid = MODEL_UNKNOWN;

//TODO: better way of doing this?
if(m_model.find("HD") != string::npos)
m_highDefinition = true;
}

void LeCroyOscilloscope::DetectAnalogChannels()
@@ -815,7 +813,6 @@ bool LeCroyOscilloscope::ReadWaveformBlock(string& data)
//Second blocks is a header including the message length. Parse that.
string lhdr = ReadSingleBlockString();
unsigned int num_bytes = atoi(lhdr.c_str() + 2);
LogDebug("lhdr: %s\n", lhdr.c_str());
if(num_bytes == 0)
{
ReadData();
@@ -897,13 +894,11 @@ bool LeCroyOscilloscope::AcquireData(bool toQueue)
if(enabled[i])
SendCommand(m_channels[i]->GetHwname() + ":WF? DESC");
}
/*for(unsigned int i=0; i<m_analogChannelCount; i++)
for(unsigned int i=0; i<m_analogChannelCount; i++)
{
if(enabled[i])
ReadWaveformBlock(wavedescs[i]);
//LogDebug("got: %s\n", wavedescs[i].c_str());
}
*/

//Figure out how many sequences we have
unsigned char* pdesc = NULL;
9 changes: 3 additions & 6 deletions scopehal/SiglentSCPIOscilloscope.cpp
Original file line number Diff line number Diff line change
@@ -70,7 +70,7 @@ void SiglentSCPIOscilloscope::DetectAnalogChannels()
{
//Siglent likes variably long model names (x, x-e, etc)
int nchans = m_model[strlen("sds120")] - '0';
//nchans = 1;
nchans = 1;
for(int i=0; i<nchans; i++)
{
//Hardware name of the channel
@@ -225,7 +225,7 @@ void SiglentSCPIOscilloscope::ReadWaveDescriptorBlock(SiglentWaveformDesc_t *des

bool SiglentSCPIOscilloscope::AcquireData(bool toQueue)
{
m_mutex.lock();
lock_guard<recursive_mutex> lock(m_mutex);

LogDebug("Acquire data\n");

@@ -246,9 +246,7 @@ bool SiglentSCPIOscilloscope::AcquireData(bool toQueue)
wavedescs.push_back(new struct SiglentWaveformDesc_t);
if(enabled[i])
{
snprintf(tmp, sizeof(tmp), "C%d:WF? DESC", i+1);
cmd = tmp;
SendCommand(cmd);
SendCommand(m_channels[i]->GetHwname() + ":WF? DESC");
ReadWaveDescriptorBlock(wavedescs[i], i);
LogDebug("name %s, number: %u\n",wavedescs[i]->InstrumentName,
wavedescs[i]->InstrumentNumber);
@@ -383,7 +381,6 @@ bool SiglentSCPIOscilloscope::AcquireData(bool toQueue)

double dt = GetTime() - start;
LogTrace("Waveform download took %.3f ms\n", dt * 1000);
m_mutex.unlock();
//Refresh protocol decoders
for(size_t i=0; i<m_channels.size(); i++)
{