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

Commits on May 26, 2020

  1. Copy the full SHA
    30e5ce6 View commit details
  2. Copy the full SHA
    37696e4 View commit details
  3. Copy the full SHA
    3186fa0 View commit details
  4. Copy the full SHA
    0d12712 View commit details

Commits on May 27, 2020

  1. Merge pull request #127 from tomverbeure/fix_yaxis

    Fix Siglent SDS2000X acquired data voltage calculation
    azonenberg authored May 27, 2020
    Copy the full SHA
    e51a370 View commit details
Showing with 18 additions and 22 deletions.
  1. +18 −22 scopehal/SiglentSCPIOscilloscope.cpp
40 changes: 18 additions & 22 deletions scopehal/SiglentSCPIOscilloscope.cpp
Original file line number Diff line number Diff line change
@@ -150,7 +150,6 @@ bool SiglentSCPIOscilloscope::AcquireData(bool toQueue)

//Read the wavedesc for every enabled channel
vector<struct SiglentWaveformDesc_t*> wavedescs;
string cmd;
bool enabled[4] = {false};
BulkCheckChannelEnableState();
for(unsigned int i=0; i<m_analogChannelCount; i++)
@@ -173,13 +172,13 @@ bool SiglentSCPIOscilloscope::AcquireData(bool toQueue)

//TODO: WFSU in outer loop and WF in inner loop
unsigned int num_sequences = 1;
for(unsigned int chan_nr=0; chan_nr<m_analogChannelCount; chan_nr++)
for(unsigned int chanNr=0; chanNr<m_analogChannelCount; chanNr++)
{
//If the channel is invisible, don't waste time capturing data
struct SiglentWaveformDesc_t *wavedesc = wavedescs[chan_nr];
if(string(wavedesc->DescName).empty())
struct SiglentWaveformDesc_t *wavedesc = wavedescs[chanNr];
if(!enabled[chanNr] || string(wavedesc->DescName).empty())
{
m_channels[chan_nr]->SetData(NULL);
m_channels[chanNr]->SetData(NULL);
continue;
}

@@ -225,26 +224,21 @@ bool SiglentSCPIOscilloscope::AcquireData(bool toQueue)
tstruc.tm_isdst = now->tm_isdst;
cap->m_startTimestamp = mktime(&tstruc);
cap->m_timescale = round(interval);
for(unsigned int seq_nr=0; seq_nr<num_sequences; seq_nr++)
for(unsigned int seqNr=0; seqNr<num_sequences; seqNr++)
{
LogDebug("Channel %u block %u\n", chan_nr, seq_nr);
LogDebug("Channel %s block %u\n", m_channels[chanNr]->GetHwname().c_str(), seqNr);

//Ask for the segment of interest
//(segment number is ignored for non-segmented waveforms)
cmd = "WAVEFORM_SETUP SP,0,NP,0,FP,0,SN,";
if(num_sequences > 1)
{
char tmp[128];
snprintf(tmp, sizeof(tmp), "%u", seq_nr + 1); //segment 0 = "all", 1 = first part of capture
cmd += tmp;
m_transport->SendCommand(cmd);
//segment 0 = "all", 1 = first part of capture
m_transport->SendCommand("WAVEFORM_SETUP SP,0,NP,0,FP,0,SN," + (seqNr+1));
}

//Read the actual waveform data
cmd = "C1:WF? DAT2";
cmd[1] += chan_nr;
m_transport->SendCommand(cmd);
char header[17] = {0};
m_transport->SendCommand(m_channels[chanNr]->GetHwname() + ":WF? DAT2");
char header[maxWaveHeaderSize] = {0};
size_t wavesize = ReadWaveHeader(header);
uint8_t *data = new uint8_t[wavesize];
m_transport->ReadRawData(wavesize, data);
@@ -253,12 +247,10 @@ bool SiglentSCPIOscilloscope::AcquireData(bool toQueue)
m_transport->ReadReply();

double trigtime = 0;
if( (num_sequences > 1) && (seq_nr > 0) )
if( (num_sequences > 1) && (seqNr > 0) )
{
//If a multi-segment capture, ask for the trigger time data
cmd = "C1:WF? TIME";
cmd[1] += chan_nr;
m_transport->SendCommand(cmd);
m_transport->SendCommand(m_channels[chanNr]->GetHwname() + ":WF? TIME");

trigtime = ReadWaveHeader(header);
// \n
@@ -289,14 +281,18 @@ bool SiglentSCPIOscilloscope::AcquireData(bool toQueue)
cap->m_offsets[i] = i+trigtime_samples;
cap->m_durations[i] = 1;
if (m_acquiredDataIsSigned)
cap->m_samples[i] = (int8_t)data[i] * v_gain - v_off;
{
// See programming guide, page 267: https://siglentna.com/wp-content/uploads/2020/04/ProgrammingGuide_PG01-E02C.pdf
// voltage value (V) = code value * (vdiv /25) - voffset
cap->m_samples[i] = (int8_t)(data[i]) * (v_gain / 25.0) - v_off;
}
else
cap->m_samples[i] = data[i] * v_gain - v_off;
}
}

//Done, update the data
m_channels[chan_nr]->SetData(cap);
m_channels[chanNr]->SetData(cap);
}

double dt = GetTime() - start;