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: 18e92c4ed063
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: 8fbf3d107883
Choose a head ref
  • 1 commit
  • 2 files changed
  • 1 contributor

Commits on Mar 1, 2020

  1. Verified

    This commit was signed with the committer’s verified signature.
    NeQuissimus Tim Steinbach
    Copy the full SHA
    8fbf3d1 View commit details
Showing with 29 additions and 8 deletions.
  1. +20 −2 glscopeclient/OscilloscopeWindow.cpp
  2. +9 −6 glscopeclient/OscilloscopeWindow.h
22 changes: 20 additions & 2 deletions glscopeclient/OscilloscopeWindow.cpp
Original file line number Diff line number Diff line change
@@ -272,8 +272,10 @@ void OscilloscopeWindow::CreateWidgets()
split->pack1(group->m_frame);

m_vbox.pack_start(m_statusbar, Gtk::PACK_SHRINK);
m_statusbar.pack_end(m_triggerConfigLabel, Gtk::PACK_SHRINK);
m_triggerConfigLabel.set_size_request(75, 1);
m_statusbar.pack_end(m_triggerConfigLabel, Gtk::PACK_SHRINK);
m_triggerConfigLabel.set_size_request(75, 1);
m_statusbar.pack_end(m_waveformRateLabel, Gtk::PACK_SHRINK);
m_waveformRateLabel.set_size_request(125, 1);

//Process all of the channels
for(auto scope : m_scopes)
@@ -1107,6 +1109,11 @@ void OscilloscopeWindow::PollScopes()

void OscilloscopeWindow::OnWaveformDataReady(Oscilloscope* scope)
{
//TODO: handle multiple scopes better
m_lastWaveformTimes.push_back(GetTime());
while(m_lastWaveformTimes.size() > 10)
m_lastWaveformTimes.erase(m_lastWaveformTimes.begin());

//make sure we close fully
if(!is_visible())
m_historyWindow.close();
@@ -1166,6 +1173,17 @@ void OscilloscopeWindow::UpdateStatusBar()
else
snprintf(tmp, sizeof(tmp), "%s %.3f V", name.c_str(), voltage);
m_triggerConfigLabel.set_label(tmp);

//Update WFM/s counter
if(m_lastWaveformTimes.size() >= 2)
{
double first = m_lastWaveformTimes[0];
double last = m_lastWaveformTimes[m_lastWaveformTimes.size() - 1];
double dt = last - first;
double wps = m_lastWaveformTimes.size() / dt;
snprintf(tmp, sizeof(tmp), "%.1f WFM/s", wps);
m_waveformRateLabel.set_label(tmp);
}
}

void OscilloscopeWindow::OnStart()
15 changes: 9 additions & 6 deletions glscopeclient/OscilloscopeWindow.h
Original file line number Diff line number Diff line change
@@ -157,8 +157,12 @@ class OscilloscopeWindow : public Gtk::Window
Gtk::ToolButton m_btnStop;
Gtk::ToggleToolButton m_btnHistory;
Gtk::ToolButton m_btnRefresh;
Gtk::Label m_alphalabel;
Gtk::HScale m_alphaslider;
Gtk::Label m_alphalabel;
Gtk::HScale m_alphaslider;
//main app windows go here
Gtk::HBox m_statusbar;
Gtk::Label m_waveformRateLabel;
Gtk::Label m_triggerConfigLabel;

//All of the splitters
std::set<Gtk::Paned*> m_splitters;
@@ -178,10 +182,6 @@ class OscilloscopeWindow : public Gtk::Window
//Event handlers
void PollScopes();

protected:
Gtk::HBox m_statusbar;
Gtk::Label m_triggerConfigLabel;

//Menu event handlers
void OnFileSave(bool saveToCurrentFile, bool saveLayout, bool saveWaveforms);
void OnEyeColorChanged(EyeColor color, Gtk::RadioMenuItem* item);
@@ -218,6 +218,9 @@ class OscilloscopeWindow : public Gtk::Window
double m_tHistory;
double m_tPoll;
double m_tEvent;

//WFM/s performance info
std::vector<double> m_lastWaveformTimes;
};

#endif