From: Soeren Apel Date: Tue, 13 Jun 2017 21:28:02 +0000 (+0200) Subject: DecodeSignal: Improve auto_assign_signals() matching X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=692f6093f949582468a23fea7725450fb5ef277b;p=pulseview.git DecodeSignal: Improve auto_assign_signals() matching Before, signals named "SCL analog" and "SDA analog" wouldn't be assigned to an I2C decoder. --- diff --git a/pv/data/decodesignal.cpp b/pv/data/decodesignal.cpp index 339c85dd..4c8548fc 100644 --- a/pv/data/decodesignal.cpp +++ b/pv/data/decodesignal.cpp @@ -265,11 +265,16 @@ void DecodeSignal::auto_assign_signals() if (ch.assigned_signal) continue; - for (shared_ptr s : session_.signalbases()) - if (s->logic_data() && (ch.name.toLower().contains(s->name().toLower()))) { + for (shared_ptr 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) {