From 0822e33a2eb713815ae2cd5d6fcca0865643bb00 Mon Sep 17 00:00:00 2001 From: Soeren Apel Date: Fri, 15 Nov 2019 23:34:22 +0100 Subject: [PATCH] Fix #1431 by using per-instance member variables --- pv/views/trace/analogsignal.cpp | 8 ++++---- pv/views/trace/analogsignal.hpp | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/pv/views/trace/analogsignal.cpp b/pv/views/trace/analogsignal.cpp index 3430ab3c..6d4b2c67 100644 --- a/pv/views/trace/analogsignal.cpp +++ b/pv/views/trace/analogsignal.cpp @@ -842,7 +842,7 @@ void AnalogSignal::perform_autoranging(bool keep_divs, bool force_update) if (segments.empty()) return; - static double prev_min = 0, prev_max = 0; + double signal_min_ = 0, signal_max_ = 0; double min = 0, max = 0; for (const shared_ptr& segment : segments) { @@ -851,11 +851,11 @@ void AnalogSignal::perform_autoranging(bool keep_divs, bool force_update) max = std::max(max, mm.second); } - if ((min == prev_min) && (max == prev_max) && !force_update) + if ((min == signal_min_) && (max == signal_max_) && !force_update) return; - prev_min = min; - prev_max = max; + signal_min_ = min; + signal_max_ = max; // If we're allowed to alter the div assignment... if (!keep_divs) { diff --git a/pv/views/trace/analogsignal.hpp b/pv/views/trace/analogsignal.hpp index fd724492..0c14b66a 100644 --- a/pv/views/trace/analogsignal.hpp +++ b/pv/views/trace/analogsignal.hpp @@ -183,6 +183,8 @@ private: *display_type_cb_; QSpinBox *pvdiv_sb_, *nvdiv_sb_, *div_height_sb_; + double signal_min_, signal_max_; // Min/max values of this signal's analog data + float scale_; int scale_index_; -- 2.11.4.GIT