]> sigrok.org Git - pulseview.git/commitdiff
Fix #1431 by using per-instance member variables
authorSoeren Apel <redacted>
Fri, 15 Nov 2019 22:34:22 +0000 (23:34 +0100)
committerSoeren Apel <redacted>
Sun, 24 Nov 2019 19:27:23 +0000 (20:27 +0100)
pv/views/trace/analogsignal.cpp
pv/views/trace/analogsignal.hpp

index 3430ab3cf48eb6996ca0cd52901c1d9c884aa4cb..6d4b2c67962a24bf4405f42e3c184d6dc60fce35 100644 (file)
@@ -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<pv::data::AnalogSegment>& 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) {
index fd724492c80e306dcabdf164fa3cd9b11f4789c2..0c14b66acd6a0e42ade65556efcf2b5dae2724e7 100644 (file)
@@ -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_;