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

Commits on May 4, 2021

  1. PicoOscilloscope: correctly position WIP trigger to midpoint of signa…

    …l regardless of other configuration. Implemented trigger phase interpolation.
    azonenberg committed May 4, 2021
    Copy the full SHA
    bda6ab2 View commit details
Showing with 18 additions and 7 deletions.
  1. +18 −7 scopehal/PicoOscilloscope.cpp
25 changes: 18 additions & 7 deletions scopehal/PicoOscilloscope.cpp
Original file line number Diff line number Diff line change
@@ -130,7 +130,6 @@ PicoOscilloscope::PicoOscilloscope(SCPITransport* transport)
trig->SetLevel(0);
trig->SetInput(0, StreamDescriptor(m_channels[0]));
SetTrigger(trig);
m_triggerOffset = 0;
PushTrigger();

//For now, assume control plane port is data plane +1
@@ -338,8 +337,7 @@ bool PicoOscilloscope::AcquireData()
//Acquire data for each channel
size_t chnum;
size_t memdepth;
float scale;
float offset;
float config[3];
SequenceSet s;
for(size_t i=0; i<numChannels; i++)
{
@@ -349,10 +347,11 @@ bool PicoOscilloscope::AcquireData()
return false;
if(!m_dataSocket->RecvLooped((uint8_t*)&memdepth, sizeof(memdepth)))
return false;
if(!m_dataSocket->RecvLooped((uint8_t*)&scale, sizeof(scale)))
return false;
if(!m_dataSocket->RecvLooped((uint8_t*)&offset, sizeof(offset)))
if(!m_dataSocket->RecvLooped((uint8_t*)&config, sizeof(config)))
return false;
float scale = config[0];
float offset = config[1];
float trigphase = -config[2] * fs_per_sample;
scale *= GetChannelAttenuation(chnum);

//TODO: stream timestamp from the server
@@ -365,7 +364,7 @@ bool PicoOscilloscope::AcquireData()
//Create our waveform
AnalogWaveform* cap = new AnalogWaveform;
cap->m_timescale = fs_per_sample;
cap->m_triggerPhase = 0;
cap->m_triggerPhase = trigphase;
cap->m_startTimestamp = time(NULL);
cap->m_densePacked = true;
double t = GetTime();
@@ -519,6 +518,10 @@ void PicoOscilloscope::SetSampleDepth(uint64_t depth)
lock_guard<recursive_mutex> lock(m_mutex);
m_transport->SendCommand(string("DEPTH ") + to_string(depth));
m_mdepth = depth;

//FIXME: set trigger delay
int64_t fs_per_sample = FS_PER_SECOND / m_srate;
m_triggerOffset = fs_per_sample * m_mdepth/2;
}

void PicoOscilloscope::SetSampleRate(uint64_t rate)
@@ -527,13 +530,21 @@ void PicoOscilloscope::SetSampleRate(uint64_t rate)

lock_guard<recursive_mutex> lock(m_mutex);
m_transport->SendCommand( string("RATE ") + to_string(rate));

//FIXME: set trigger delay
int64_t fs_per_sample = FS_PER_SECOND / m_srate;
m_triggerOffset = fs_per_sample * m_mdepth/2;
}

void PicoOscilloscope::SetTriggerOffset(int64_t offset)
{
lock_guard<recursive_mutex> lock(m_mutex);
m_triggerOffset = offset;
PushTrigger();

//FIXME: set trigger delay
int64_t fs_per_sample = FS_PER_SECOND / m_srate;
m_triggerOffset = fs_per_sample * m_mdepth/2;
}

int64_t PicoOscilloscope::GetTriggerOffset()