]> sigrok.org Git - pulseview.git/commitdiff
Fix #942 by making sure we always have at least one positive div
authorSoeren Apel <redacted>
Wed, 24 May 2017 11:45:04 +0000 (13:45 +0200)
committerSoeren Apel <redacted>
Fri, 26 May 2017 17:36:04 +0000 (19:36 +0200)
pv/view/analogsignal.cpp

index 8f6027b7a52f990135fc54cbe0881b93fc4d1c0a..63e759f97ed7411922b70e2af4946dd2df643ad9 100644 (file)
@@ -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);