From 681b6d5a08c604e0dab71d35a27983e34359af7b Mon Sep 17 00:00:00 2001 From: Soeren Apel Date: Tue, 14 Feb 2017 00:12:54 +0100 Subject: [PATCH] AnalogSignal: Split up divs during autoranging if needed --- pv/view/analogsignal.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pv/view/analogsignal.cpp b/pv/view/analogsignal.cpp index d9ac2f60..2715a386 100644 --- a/pv/view/analogsignal.cpp +++ b/pv/view/analogsignal.cpp @@ -389,6 +389,12 @@ void AnalogSignal::perform_autoranging(bool force_update) neg_vdivs_ = 0; } + // Split up the divs if there are negative values but no negative divs + if ((min < 0) && (neg_vdivs_ == 0)) { + neg_vdivs_ = pos_vdivs_ / 2; + pos_vdivs_ -= neg_vdivs_; + } + double min_value_per_div; if ((pos_vdivs_ > 0) && (neg_vdivs_ > 0)) min_value_per_div = std::max(max / pos_vdivs_, -min / neg_vdivs_); -- 2.30.2