g_str_equal, g_free, (GDestroyNotify)g_variant_unref);
for (DecodeChannel *ch : channels_) {
+ if (!ch->assigned_signal)
+ continue;
+
init_pin_states->data[ch->id] = ch->initial_pin_state;
- GVariant *const gvar = g_variant_new_int32(ch->id); // id = bit position
+ GVariant *const gvar = g_variant_new_int32(ch->bit_id); // bit_id = bit position
g_variant_ref_sink(gvar);
- // key is channel name, value is bit position in each sample
+ // key is channel name (pdch->id), value is bit position in each sample (gvar)
g_hash_table_insert(channels, ch->pdch_->id, gvar);
}
if (!ch_added) {
// Create new entry without a mapped signal
- data::DecodeChannel ch = {id++, false, nullptr,
+ data::DecodeChannel ch = {id++, 0, false, nullptr,
QString::fromUtf8(pdch->name), QString::fromUtf8(pdch->desc),
SRD_INITIAL_PIN_SAME_AS_SAMPLE0, decoder, pdch};
channels_.push_back(ch);
if (!ch_added) {
// Create new entry without a mapped signal
- data::DecodeChannel ch = {id++, true, nullptr,
+ data::DecodeChannel ch = {id++, 0, true, nullptr,
QString::fromUtf8(pdch->name), QString::fromUtf8(pdch->desc),
SRD_INITIAL_PIN_SAME_AS_SAMPLE0, decoder, pdch};
channels_.push_back(ch);
vector<uint8_t> signal_in_bytepos;
vector<uint8_t> signal_in_bitpos;
+ int id = 0;
for (data::DecodeChannel &ch : channels_)
if (ch.assigned_signal) {
+ ch.bit_id = id++;
+
const shared_ptr<Logic> logic_data = ch.assigned_signal->logic_data();
const shared_ptr<LogicSegment> segment = logic_data->logic_segments().front();
segments.push_back(segment);
struct DecodeChannel
{
- uint16_t id; // Also tells which bit within a sample represents this channel
+ uint16_t id; ///< Global numerical ID for the decode channels in the stack
+ uint16_t bit_id; ///< Tells which bit within a sample represents this channel
const bool is_optional;
const pv::data::SignalBase *assigned_signal;
const QString name, desc;