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

Commits on Jul 30, 2020

  1. Copy the full SHA
    87f3902 View commit details
  2. Copy the full SHA
    d38fd14 View commit details
  3. Merge pull request #202 from noopwafel/rigol-misc-fixes

    misc Rigol fixes
    azonenberg authored Jul 30, 2020
    Copy the full SHA
    073dc63 View commit details
Showing with 23 additions and 12 deletions.
  1. +23 −12 scopehal/RigolOscilloscope.cpp
35 changes: 23 additions & 12 deletions scopehal/RigolOscilloscope.cpp
Original file line number Diff line number Diff line change
@@ -648,7 +648,7 @@ bool RigolOscilloscope::AcquireData(bool toQueue)
cap->m_startPicoseconds = (t - floor(t)) * 1e12f;

//Downloading the waveform is a pain in the butt, because we can only pull 250K points at a time!
for(size_t npoint = 0; npoint < maxpoints; npoint += maxpoints)
for(size_t npoint = 0; npoint < npoints; )
{
//Ask for the data
char tmp[128];
@@ -667,16 +667,28 @@ bool RigolOscilloscope::AcquireData(bool toQueue)
unsigned char header[12] = {0};

double start = GetTime();
m_transport->ReadRawData(11, header);
unsigned char header_size;
m_transport->ReadRawData(2, header);
LogWarning("Time %f\n", (GetTime() - start));

sscanf((char*)header, "#%c", &header_size);
header_size = header_size - '0';

m_transport->ReadRawData(header_size, header);

//Look up the block size
//size_t blocksize = end - npoints;
//LogDebug("Block size = %zu\n", blocksize);
size_t header_blocksize;
sscanf((char*)header, "#9%zu", &header_blocksize);
sscanf((char*)header, "%zu", &header_blocksize);
//LogDebug("Header block size = %zu\n", header_blocksize);

if (header_blocksize == 0)
{
LogWarning("Ran out of data after %d points\n", npoint);
break;
}

//Read actual block content and decode it
//Scale: (value - Yorigin - Yref) * Yinc
m_transport->ReadRawData(header_blocksize + 1, temp_buf); //why is there a trailing byte here??´
@@ -692,12 +704,14 @@ bool RigolOscilloscope::AcquireData(bool toQueue)
cap->m_samples[npoint + j] = v;
}

//Done, update the data
if(npoint == 0 && !toQueue)
m_channels[i]->SetData(cap);
else
pending_waveforms[i].push_back(cap);
npoint += header_blocksize;
}

//Done, update the data
if(!toQueue)
m_channels[i]->SetData(cap);
else
pending_waveforms[i].push_back(cap);
}

//Now that we have all of the pending waveforms, save them in sets across all channels
@@ -725,10 +739,7 @@ bool RigolOscilloscope::AcquireData(bool toQueue)
//Re-arm the trigger if not in one-shot mode
if(!m_triggerOneShot)
{
if(m_protocol == DS)
m_transport->SendCommand("TRIG_MODE SINGLE");
else if(m_protocol == MSO5)
m_transport->SendCommand("SING");
m_transport->SendCommand("SING");
m_triggerArmed = true;
}