From: Soeren Apel Date: Mon, 13 Feb 2017 23:12:54 +0000 (+0100) Subject: AnalogSignal: Split up divs during autoranging if needed X-Git-Tag: pulseview-0.4.0~188 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=681b6d5a08c604e0dab71d35a27983e34359af7b;p=pulseview.git AnalogSignal: Split up divs during autoranging if needed --- 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_);