Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support clipping as a flag on waveforms; support on DSLabs #595

Merged
merged 1 commit into from
Apr 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions scopehal/DSLabsOscilloscope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,10 @@ bool DSLabsOscilloscope::AcquireData()
scale *= GetChannelAttenuation(chnum);
offset *= GetChannelAttenuation(chnum);

bool clipping;
if(!m_transport->ReadRawData(sizeof(clipping), (uint8_t*)&clipping))
return false;

//TODO: stream timestamp from the server

if(!m_transport->ReadRawData(memdepth * sizeof(int8_t), (uint8_t*)buf))
Expand All @@ -328,6 +332,9 @@ bool DSLabsOscilloscope::AcquireData()
cap->m_startTimestamp = time(NULL);
cap->m_densePacked = true;
cap->m_startFemtoseconds = fs;
if (clipping)
cap->m_flags |= WaveformBase::WAVEFORM_CLIPPING;

cap->Resize(memdepth);
awfms.push_back(cap);
scales.push_back(scale);
Expand Down
12 changes: 12 additions & 0 deletions scopehal/Waveform.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ class WaveformBase
, m_startFemtoseconds(0)
, m_triggerPhase(0)
, m_densePacked(false)
, m_flags(0)
{}

//empty virtual destructor in case any derived classes need one
Expand Down Expand Up @@ -127,6 +128,17 @@ class WaveformBase
*/
bool m_densePacked;

/**
@brief Flags that apply to this waveform. Bitfield.

WAVEFORM_CLIPPING: Scope indicated that this waveform is clipped.
*/
uint8_t m_flags;

enum {
WAVEFORM_CLIPPING = 1
};

///@brief Start timestamps of each sample
std::vector<
EmptyConstructorWrapper<int64_t>,
Expand Down