]> sigrok.org Git - libsigrok.git/commitdiff
output/csv: get proper index for input channels
authorWolfram Sang <redacted>
Thu, 11 May 2017 11:51:10 +0000 (13:51 +0200)
committerUwe Hermann <redacted>
Sat, 13 May 2017 20:34:17 +0000 (22:34 +0200)
'j' is the loop variable for channels, not 'ch'.

This fixes parts of bug #844.

Signed-off-by: Wolfram Sang <redacted>
src/output/csv.c

index dd94f28d694f61a039e95e1114f2cdeea129f5e8..831208dc6bf367f40a7d088cb7b4360dd56b0076 100644 (file)
@@ -380,7 +380,7 @@ static void process_logic(struct context *ctx,
                if (ctx->channels[j].ch->type == SR_CHANNEL_LOGIC) {
                        for (i = 0; i < num_samples; i++) {
                                sample = logic->data + i * logic->unitsize;
-                               idx = ctx->channels[ch].ch->index;
+                               idx = ctx->channels[j].ch->index;
                                if (ctx->label_do && !ctx->label_names)
                                        ctx->channels[j].label = "logic";
                                ctx->logic_samples[i * ctx->num_logic_channels + ch] = sample[idx / 8] & (1 << (idx % 8));