From: Soeren Apel Date: Mon, 22 Jun 2020 18:14:59 +0000 (+0200) Subject: DecodeSignal: Receive RLE-encoded PD logic output data X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=f4e61cbe0babc594285625e51b6d2705e37288c5;p=pulseview.git DecodeSignal: Receive RLE-encoded PD logic output data --- diff --git a/pv/data/decodesignal.cpp b/pv/data/decodesignal.cpp index 09f0d20c..352edc05 100644 --- a/pv/data/decodesignal.cpp +++ b/pv/data/decodesignal.cpp @@ -1752,6 +1752,8 @@ void DecodeSignal::logic_output_callback(srd_proto_data *pdata, void *decode_sig const srd_proto_data_logic *const pdl = (const srd_proto_data_logic*)pdata->data; assert(pdl); + assert(pdl->logic_group == 0); // FIXME Only one group supported for now + shared_ptr output_logic = ds->output_logic_.at(decc); vector< shared_ptr > segments = output_logic->segments(); @@ -1770,21 +1772,18 @@ void DecodeSignal::logic_output_callback(srd_proto_data *pdata, void *decode_sig if (pdata->start_sample < pdata->end_sample) { vector data; - for (unsigned int i = pdata->start_sample; i < pdata->end_sample; i++) + data.reserve(pdl->repeat_count + 1); // FIXME Include unit size in calculation + for (unsigned int i = 0; i <= pdl->repeat_count; i++) + // FIXME Currently only supports 8 channels as we ignore the unit size data.emplace_back(*((uint8_t*)pdl->data)); - if ((pdl->logic_class == 0) || ((pdl->logic_class > 0) && (data.size() <= ds->output_logic_muxed_data_.at(decc).size()))) { - last_segment->append_subsignal_payload(pdl->logic_class, data.data(), - data.size(), ds->output_logic_muxed_data_.at(decc)); + last_segment->append_payload(data.data(), data.size()); - qInfo() << "Received logic output state change for class" << pdl->logic_class << "from decoder" \ - << QString::fromUtf8(decc->name) << "from" << pdata->start_sample << "to" << pdata->end_sample; - } else - qWarning() << "Ignoring invalid logic output state change for class" << pdl->logic_class << "from decoder" \ - << QString::fromUtf8(decc->name) << "from" << pdata->start_sample << "to" << pdata->end_sample; + qInfo() << "Received logic output state change for group" << pdl->logic_group << "from decoder" \ + << QString::fromUtf8(decc->name) << "from" << pdata->start_sample << "to" << pdata->end_sample << ":" << *((uint8_t*)pdl->data); } else - qWarning() << "Ignoring malformed logic output state change for class" << pdl->logic_class << "from decoder" \ + qWarning() << "Ignoring malformed logic output state change for group" << pdl->logic_group << "from decoder" \ << QString::fromUtf8(decc->name) << "from" << pdata->start_sample << "to" << pdata->end_sample; }