Skip to content

Commit

Permalink
Merge pull request #595 from 602p/clipping
Browse files Browse the repository at this point in the history
Support clipping as a flag on waveforms; support on DSLabs
  • Loading branch information
azonenberg committed Apr 14, 2022
2 parents 87727de + 8953cd7 commit c654fa5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
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

0 comments on commit c654fa5

Please sign in to comment.