]> sigrok.org Git - pulseview.git/commitdiff
Fix #1637 by auto-assigning only to unused signals
authorSoeren Apel <redacted>
Sun, 15 Nov 2020 19:58:40 +0000 (20:58 +0100)
committerSoeren Apel <redacted>
Sun, 15 Nov 2020 19:58:40 +0000 (20:58 +0100)
pv/data/decodesignal.cpp

index ed29cafe45ac4cde4202fcb144f56c7f89437866..bda8d51ee864cc97e42ffde55424a60331260a1e 100644 (file)
@@ -308,7 +308,13 @@ void DecodeSignal::auto_assign_signals(const shared_ptr<Decoder> dec)
                        }
                }
 
-               if (match) {
+               // Prevent using a signal more than once as D1 would match e.g. D1 and D10
+               bool signal_not_already_used = true;
+               for (decode::DecodeChannel& ch : channels_)
+                       if (ch.assigned_signal && (ch.assigned_signal == match))
+                               signal_not_already_used = false;
+
+               if (match && signal_not_already_used) {
                        ch.assigned_signal = match;
                        new_assignment = true;
                }