From 8953cd763598ef06e4875b5d45f7bb8250cff17f Mon Sep 17 00:00:00 2001 From: Louis Goessling Date: Thu, 14 Apr 2022 15:46:19 -0500 Subject: [PATCH] Support clipping as a flag on waveforms; support clipping info from DSLabs bridge --- scopehal/DSLabsOscilloscope.cpp | 7 +++++++ scopehal/Waveform.h | 12 ++++++++++++ 2 files changed, 19 insertions(+) diff --git a/scopehal/DSLabsOscilloscope.cpp b/scopehal/DSLabsOscilloscope.cpp index 7e8e57ba..ce86c406 100644 --- a/scopehal/DSLabsOscilloscope.cpp +++ b/scopehal/DSLabsOscilloscope.cpp @@ -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)) @@ -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); diff --git a/scopehal/Waveform.h b/scopehal/Waveform.h index 3d4be5eb..06d1506a 100644 --- a/scopehal/Waveform.h +++ b/scopehal/Waveform.h @@ -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 @@ -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,