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

Commits on Sep 28, 2020

  1. Tek 5/6 spectrum view channels now display peaks. Hard coded to 10 pe…

    …aks at 1 MHz minimum spacing for now. See #269.
    azonenberg committed Sep 28, 2020
    Copy the full SHA
    f39cd4e View commit details
Showing with 110 additions and 4 deletions.
  1. +1 −0 scopehal/CMakeLists.txt
  2. +51 −0 scopehal/SpectrumChannel.cpp
  3. +52 −0 scopehal/SpectrumChannel.h
  4. +5 −4 scopehal/TektronixOscilloscope.cpp
  5. +1 −0 scopehal/scopehal.h
1 change: 1 addition & 0 deletions scopehal/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -72,6 +72,7 @@ set(SCOPEHAL_SOURCES
PacketDecoder.cpp
PeakDetectionFilter.cpp
Statistic.cpp
SpectrumChannel.cpp
)

add_library(scopehal SHARED
51 changes: 51 additions & 0 deletions scopehal/SpectrumChannel.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/***********************************************************************************************************************
* *
* ANTIKERNEL v0.1 *
* *
* Copyright (c) 2012-2020 Andrew D. Zonenberg *
* All rights reserved. *
* *
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the *
* following conditions are met: *
* *
* * Redistributions of source code must retain the above copyright notice, this list of conditions, and the *
* following disclaimer. *
* *
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the *
* following disclaimer in the documentation and/or other materials provided with the distribution. *
* *
* * Neither the name of the author nor the names of any contributors may be used to endorse or promote products *
* derived from this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL *
* THE AUTHORS BE HELD LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES *
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR *
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE *
* POSSIBILITY OF SUCH DAMAGE. *
* *
***********************************************************************************************************************/

#include "scopehal.h"

using namespace std;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Construction / destruction

SpectrumChannel::SpectrumChannel(
Oscilloscope* scope,
string hwname,
OscilloscopeChannel::ChannelType type,
string color,
size_t index,
bool physical
)
: OscilloscopeChannel(scope, hwname, type, color, Unit(Unit::UNIT_HZ), Unit(Unit::UNIT_DBM), 1, index, physical)
{
}

SpectrumChannel::~SpectrumChannel()
{
}
52 changes: 52 additions & 0 deletions scopehal/SpectrumChannel.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/***********************************************************************************************************************
* *
* ANTIKERNEL v0.1 *
* *
* Copyright (c) 2012-2020 Andrew D. Zonenberg *
* All rights reserved. *
* *
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the *
* following conditions are met: *
* *
* * Redistributions of source code must retain the above copyright notice, this list of conditions, and the *
* following disclaimer. *
* *
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the *
* following disclaimer in the documentation and/or other materials provided with the distribution. *
* *
* * Neither the name of the author nor the names of any contributors may be used to endorse or promote products *
* derived from this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL *
* THE AUTHORS BE HELD LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES *
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR *
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE *
* POSSIBILITY OF SUCH DAMAGE. *
* *
***********************************************************************************************************************/

#ifndef SpectrumChannel_h
#define SpectrumChannel_h

/**
@brief A frequency domain oscilloscope channel
*/
class SpectrumChannel
: public OscilloscopeChannel
, public PeakDetector
{
public:
SpectrumChannel(
Oscilloscope* scope,
std::string hwname,
OscilloscopeChannel::ChannelType type,
std::string color,
size_t index,
bool physical = false
);
virtual ~SpectrumChannel();
};

#endif
9 changes: 5 additions & 4 deletions scopehal/TektronixOscilloscope.cpp
Original file line number Diff line number Diff line change
@@ -140,14 +140,11 @@ TektronixOscilloscope::TektronixOscilloscope(SCPITransport* transport)
for(size_t i=0; i<m_analogChannelCount; i++)
{
m_channels.push_back(
new OscilloscopeChannel(
new SpectrumChannel(
this,
string("CH") + to_string(i+1) + "_SPECTRUM",
OscilloscopeChannel::CHANNEL_TYPE_ANALOG,
colors_mso56[i % 4],
Unit(Unit::UNIT_HZ),
Unit(Unit::UNIT_DBM),
1,
m_channels.size(),
true));
}
@@ -1276,6 +1273,10 @@ bool TektronixOscilloscope::AcquireDataMSO56(map<int, vector<WaveformBase*> >& p

//Throw out garbage at the end of the message (why is this needed?)
m_transport->ReadReply();

//Look for peaks
//TODO: make this configurable, for now 1 MHz spacing and up to 10 peaks
dynamic_cast<SpectrumChannel*>(m_channels[nchan])->FindPeaks(cap, 10, 1000000);
}

//Get the digital stuff
1 change: 1 addition & 0 deletions scopehal/scopehal.h
Original file line number Diff line number Diff line change
@@ -79,6 +79,7 @@
#include "FilterParameter.h"
#include "Filter.h"
#include "PeakDetectionFilter.h"
#include "SpectrumChannel.h"

#include "SParameters.h"
#include "TouchstoneParser.h"