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

Commits on Mar 4, 2020

  1. Fixed several crashes and bugs around multi-scope support. Now have o…

    …ne history window per scope.
    azonenberg committed Mar 4, 2020
    Copy the full SHA
    8e6f7b1 View commit details
15 changes: 8 additions & 7 deletions glscopeclient/HistoryWindow.cpp
Original file line number Diff line number Diff line change
@@ -51,11 +51,12 @@ HistoryColumns::HistoryColumns()
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Construction / destruction

HistoryWindow::HistoryWindow(OscilloscopeWindow* parent)
HistoryWindow::HistoryWindow(OscilloscopeWindow* parent, Oscilloscope* scope)
: m_parent(parent)
, m_scope(scope)
, m_updating(false)
{
set_title("History");
set_title(string("History: ") + m_scope->m_nickname);

set_default_size(320, 800);

@@ -103,14 +104,14 @@ HistoryWindow::~HistoryWindow()
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Event handlers

void HistoryWindow::OnWaveformDataReady(Oscilloscope* scope)
void HistoryWindow::OnWaveformDataReady()
{
//Use the timestamp from the first enabled channel
OscilloscopeChannel* chan = NULL;
CaptureChannelBase* data = NULL;
for(size_t i=0; i<scope->GetChannelCount(); i++)
for(size_t i=0; i<m_scope->GetChannelCount(); i++)
{
chan = scope->GetChannel(i);
chan = m_scope->GetChannel(i);
if(chan->IsEnabled())
{
data = chan->GetData();
@@ -143,9 +144,9 @@ void HistoryWindow::OnWaveformDataReady(Oscilloscope* scope)

//Add waveform data
WaveformHistory hist;
for(size_t i=0; i<scope->GetChannelCount(); i++)
for(size_t i=0; i<m_scope->GetChannelCount(); i++)
{
auto c = scope->GetChannel(i);
auto c = m_scope->GetChannel(i);
auto dat = c->GetData();
if(!c->IsEnabled()) //don't save historical waveforms from disabled channels
{
7 changes: 4 additions & 3 deletions glscopeclient/HistoryWindow.h
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
* *
* ANTIKERNEL v0.1 *
* *
* Copyright (c) 2012-2019 Andrew D. Zonenberg *
* 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 *
@@ -56,10 +56,10 @@ class HistoryColumns : public Gtk::TreeModel::ColumnRecord
class HistoryWindow : public Gtk::Window
{
public:
HistoryWindow(OscilloscopeWindow* parent);
HistoryWindow(OscilloscopeWindow* parent, Oscilloscope* scope);
~HistoryWindow();

void OnWaveformDataReady(Oscilloscope* scope);
void OnWaveformDataReady();
void JumpToHistory(TimePoint timestamp);

protected:
@@ -78,6 +78,7 @@ class HistoryWindow : public Gtk::Window
HistoryColumns m_columns;

OscilloscopeWindow* m_parent;
Oscilloscope* m_scope;
bool m_updating;
};

36 changes: 26 additions & 10 deletions glscopeclient/OscilloscopeWindow.cpp
Original file line number Diff line number Diff line change
@@ -50,8 +50,7 @@ using namespace std;
@brief Initializes the main window
*/
OscilloscopeWindow::OscilloscopeWindow(vector<Oscilloscope*> scopes)
: m_historyWindow(this)
, m_scopes(scopes)
: m_scopes(scopes)
// m_iconTheme(Gtk::IconTheme::get_default())
{
//Set title
@@ -109,6 +108,9 @@ OscilloscopeWindow::~OscilloscopeWindow()
LogDebug("POLL: %.3f ms\n", m_tPoll * 1000);
LogDebug("EVENT: %.3f ms\n", m_tEvent * 1000);

for(auto it : m_historyWindows)
delete it.second;

for(auto a : m_analyzers)
delete a;
for(auto s : m_splitters)
@@ -119,8 +121,6 @@ OscilloscopeWindow::~OscilloscopeWindow()
delete w;

//decoders should self-delete when the last reference to them is removed
//for(auto d : m_decoders)
// delete d;
}

/**
@@ -281,6 +281,10 @@ void OscilloscopeWindow::CreateWidgets()
m_statusbar.pack_end(m_waveformRateLabel, Gtk::PACK_SHRINK);
m_waveformRateLabel.set_size_request(125, 1);

//Create history windows
for(auto scope : m_scopes)
m_historyWindows[scope] = new HistoryWindow(this, scope);

//Process all of the channels
for(auto scope : m_scopes)
{
@@ -335,7 +339,8 @@ void OscilloscopeWindow::CreateWidgets()

m_channelsMenu.show_all();

m_historyWindow.hide();
for(auto it : m_historyWindows)
it.second->hide();

//Done adding widgets
show_all();
@@ -765,9 +770,15 @@ OscilloscopeWindow::EyeColor OscilloscopeWindow::GetEyeColor()
void OscilloscopeWindow::OnHistory()
{
if(m_btnHistory.get_active())
m_historyWindow.show();
{
for(auto it : m_historyWindows)
it.second->show();
}
else
m_historyWindow.hide();
{
for(auto it : m_historyWindows)
it.second->hide();
}
}

void OscilloscopeWindow::OnMoveNewRight(WaveformArea* w)
@@ -1140,7 +1151,10 @@ void OscilloscopeWindow::OnWaveformDataReady(Oscilloscope* scope)

//make sure we close fully
if(!is_visible())
m_historyWindow.close();
{
for(auto it : m_historyWindows)
it.second->close();
}

//Make sure we don't free the old waveform data
//LogTrace("Detaching\n");
@@ -1173,7 +1187,7 @@ void OscilloscopeWindow::OnWaveformDataReady(Oscilloscope* scope)
a->OnWaveformDataReady();

//Update the history window
m_historyWindow.OnWaveformDataReady(scope);
m_historyWindows[scope]->OnWaveformDataReady();

m_tHistory += GetTime() - start;
}
@@ -1274,5 +1288,7 @@ void OscilloscopeWindow::RemoveHistory(TimePoint timestamp)

void OscilloscopeWindow::JumpToHistory(TimePoint timestamp)
{
m_historyWindow.JumpToHistory(timestamp);
//TODO: this might not work too well if triggers aren't perfectly synced!
for(auto it : m_historyWindows)
it.second->JumpToHistory(timestamp);
}
2 changes: 1 addition & 1 deletion glscopeclient/OscilloscopeWindow.h
Original file line number Diff line number Diff line change
@@ -170,7 +170,7 @@ class OscilloscopeWindow : public Gtk::Window
std::set<Gtk::Paned*> m_splitters;

//shared by all scopes/channels
HistoryWindow m_historyWindow;
std::map<Oscilloscope*, HistoryWindow*> m_historyWindows;

public:
//All of the waveform groups and areas, regardless of where they live
7 changes: 3 additions & 4 deletions glscopeclient/WaveformArea.cpp
Original file line number Diff line number Diff line change
@@ -672,18 +672,17 @@ bool WaveformArea::IsWaterfall()

bool WaveformArea::IsDigital()
{
auto pdat = m_channel->GetData();
return (dynamic_cast<DigitalCapture*>(pdat) != NULL);
return (m_channel->GetType() == OscilloscopeChannel::CHANNEL_TYPE_DIGITAL);
}

bool WaveformArea::IsAnalog()
{
auto pdat = m_channel->GetData();
return (dynamic_cast<AnalogCapture*>(pdat) != NULL);
return (m_channel->GetType() == OscilloscopeChannel::CHANNEL_TYPE_ANALOG);
}

bool WaveformArea::IsEye()
{
//TODO: there are other possible sources for eyes, e.g. FREESAMPLE. Maybe define a CHANNEL_TYPE for it?
auto eye = dynamic_cast<EyeDecoder2*>(m_channel);
return (eye != NULL);
}
22 changes: 16 additions & 6 deletions glscopeclient/WaveformArea_rendering.cpp
Original file line number Diff line number Diff line change
@@ -54,21 +54,31 @@ void WaveformArea::PrepareGeometry(WaveformRenderData* wdata)
{
double start = GetTime();

//We need analog or digital data to render
auto channel = wdata->m_channel;
if( (channel->GetType() != OscilloscopeChannel::CHANNEL_TYPE_DIGITAL) &&
(channel->GetType() != OscilloscopeChannel::CHANNEL_TYPE_ANALOG))
{
wdata->m_geometryOK = false;
return;
}
auto pdat = channel->GetData();
if( (pdat == NULL) || (pdat->GetDepth() == 0) )
{
wdata->m_geometryOK = false;
return;
}

//Make sure capture is the right type
auto andat = dynamic_cast<AnalogCapture*>(pdat);
auto digdat = dynamic_cast<DigitalCapture*>(pdat);
if( !(andat && andat->GetDepth()) && !(digdat && digdat->GetDepth()))
if(!andat && !digdat)
{
wdata->m_geometryOK = false;
return;
}

size_t count;
if(andat)
count = andat->size();
else
count = digdat->size();
size_t count = pdat->GetDepth();
double xscale = pdat->m_timescale * m_group->m_pixelsPerXUnit;
float xoff = (pdat->m_triggerPhase - m_group->m_xAxisOffset) * m_group->m_pixelsPerXUnit;