From 80067e4944e111bfa8d6b399812dddaa29d5a4ab Mon Sep 17 00:00:00 2001 From: Soeren Apel Date: Wed, 24 May 2017 13:45:04 +0200 Subject: [PATCH] Fix #942 by making sure we always have at least one positive div --- pv/view/analogsignal.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pv/view/analogsignal.cpp b/pv/view/analogsignal.cpp index 8f6027b..63e759f 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); -- 2.30.2