From: Soeren Apel Date: Wed, 24 May 2017 11:45:04 +0000 (+0200) Subject: Fix #942 by making sure we always have at least one positive div X-Git-Tag: pulseview-0.4.0~79 X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=commitdiff_plain;h=80067e4944e111bfa8d6b399812dddaa29d5a4ab;hp=430b94aaa74cbbbf805803a013b77a4d1e18daaf Fix #942 by making sure we always have at least one positive div --- diff --git a/pv/view/analogsignal.cpp b/pv/view/analogsignal.cpp index 8f6027b7..63e759f9 100644 --- a/pv/view/analogsignal.cpp +++ b/pv/view/analogsignal.cpp @@ -737,6 +737,13 @@ void AnalogSignal::on_pos_vdivs_changed(int vdivs) pos_vdivs_ = vdivs; + // There has to be at least one div, positive or negative + if ((neg_vdivs_ == 0) && (pos_vdivs_ == 0)) { + pos_vdivs_ = 1; + if (pvdiv_sb_) + pvdiv_sb_->setValue(pos_vdivs_); + } + if (autoranging_) { perform_autoranging(true, true); @@ -761,6 +768,13 @@ void AnalogSignal::on_neg_vdivs_changed(int vdivs) neg_vdivs_ = vdivs; + // There has to be at least one div, positive or negative + if ((neg_vdivs_ == 0) && (pos_vdivs_ == 0)) { + pos_vdivs_ = 1; + if (pvdiv_sb_) + pvdiv_sb_->setValue(pos_vdivs_); + } + if (autoranging_) { perform_autoranging(true, true);