forked from Ivasoft/DSView
fix save/export issue when sample depth greater than 4G, or part of channels enabled
This commit is contained in:
@@ -93,7 +93,8 @@ static int init(struct sr_output *o, GHashTable *options)
|
||||
if (!ch->enabled)
|
||||
continue;
|
||||
ctx->channel_index[i] = ch->index;
|
||||
ctx->mask |= (1 << ch->index);
|
||||
//ctx->mask |= (1 << ch->index);
|
||||
ctx->mask |= (1 << i);
|
||||
ctx->channel_vdiv[i] = ch->vdiv * ch->vfactor >= 500 ? ch->vdiv * ch->vfactor / 100.0f : ch->vdiv * ch->vfactor * 10.0f;
|
||||
ctx->channel_vpos[i] = ch->vdiv * ch->vfactor >= 500 ? ch->vpos / 1000 : ch->vpos;
|
||||
i++;
|
||||
@@ -217,7 +218,8 @@ static int receive(const struct sr_output *o, const struct sr_datafeed_packet *p
|
||||
continue;
|
||||
g_string_append_printf(*out, "%0.10g", (ctx->index-1)*1.0/ctx->samplerate);
|
||||
for (j = 0; j < ctx->num_enabled_channels; j++) {
|
||||
idx = ctx->channel_index[j];
|
||||
//idx = ctx->channel_index[j];
|
||||
idx = j;
|
||||
p = logic->data + i + idx / 8;
|
||||
c = *p & (1 << (idx % 8));
|
||||
g_string_append_c(*out, ctx->separator);
|
||||
|
||||
@@ -191,11 +191,12 @@ static int receive(const struct sr_output *o, const struct sr_datafeed_packet *p
|
||||
memcpy(ctx->prevsample, sample, logic->unitsize);
|
||||
|
||||
/* The first column is a counter (needed for gnuplot). */
|
||||
g_string_append_printf(*out, "%"PRIu64"\t", ctx->samplecount);
|
||||
g_string_append_printf(*out, "%"PRIu64"\t", ctx->samplecount-1);
|
||||
|
||||
/* The next columns are the values of all channels. */
|
||||
for (p = 0; p < ctx->num_enabled_channels; p++) {
|
||||
idx = ctx->channel_index[p];
|
||||
//idx = ctx->channel_index[p];
|
||||
idx = p;
|
||||
curbit = (sample[idx / 8] & ((uint8_t) (1 << (idx % 8)))) >> (idx % 8);
|
||||
g_string_append_printf(*out, "%d ", curbit);
|
||||
}
|
||||
|
||||
@@ -201,7 +201,8 @@ static int receive(const struct sr_output *o, const struct sr_datafeed_packet *p
|
||||
timestamp_written = FALSE;
|
||||
|
||||
for (p = 0; p < ctx->num_enabled_channels; p++) {
|
||||
index = ctx->channel_index[p];
|
||||
//index = ctx->channel_index[p];
|
||||
index = p;
|
||||
|
||||
curbit = ((unsigned)sample[index / 8]
|
||||
>> (index % 8)) & 1;
|
||||
|
||||
Reference in New Issue
Block a user