]> sigrok.org Git - pulseview.git/commitdiff
DecodeSignal: Improve auto_assign_signals() matching
authorSoeren Apel <redacted>
Tue, 13 Jun 2017 21:28:02 +0000 (23:28 +0200)
committerUwe Hermann <redacted>
Wed, 5 Jul 2017 22:37:08 +0000 (00:37 +0200)
Before, signals named "SCL analog" and "SDA analog"
wouldn't be assigned to an I2C decoder.

pv/data/decodesignal.cpp

index 339c85dd01dd0305879bce1dc88d3fde6d8ec6e3..4c8548fc8280fb8bf564e0cc98221de1aac41505 100644 (file)
@@ -265,11 +265,16 @@ void DecodeSignal::auto_assign_signals()
                if (ch.assigned_signal)
                        continue;
 
-               for (shared_ptr<data::SignalBase> s : session_.signalbases())
-                       if (s->logic_data() && (ch.name.toLower().contains(s->name().toLower()))) {
+               for (shared_ptr<data::SignalBase> s : session_.signalbases()) {
+                       const QString ch_name = ch.name.toLower();
+                       const QString s_name = s->name().toLower();
+
+                       if (s->logic_data() &&
+                               ((ch_name.contains(s_name)) || (s_name.contains(ch_name)))) {
                                ch.assigned_signal = s.get();
                                new_assignment = true;
                        }
+               }
        }
 
        if (new_assignment) {