mirror of
https://github.com/DreamSourceLab/DSView.git
synced 2025-01-23 13:42:55 +08:00
fix save/export issue when sample depth greater than 4G, or part of channels enabled
This commit is contained in:
parent
7dc868140d
commit
0b9fe2236e
@ -220,12 +220,15 @@ void LogicSnapshot::append_cross_payload(
|
||||
if (_sample_count >= _total_sample_count)
|
||||
return;
|
||||
|
||||
_src_ptr = logic.data;
|
||||
uint64_t len = logic.length;
|
||||
uint64_t samples = ceil(logic.length * 8.0 / _channel_num);
|
||||
|
||||
if (_sample_count + samples < _total_sample_count)
|
||||
if (_sample_count + samples < _total_sample_count) {
|
||||
_sample_count += samples;
|
||||
else
|
||||
} else {
|
||||
len = ceil((_total_sample_count - _sample_count) * _channel_num / 8.0);
|
||||
_sample_count = _total_sample_count;
|
||||
}
|
||||
|
||||
while (_sample_count > _block_num * LeafBlockSamples) {
|
||||
uint8_t index0 = _block_num / RootScale;
|
||||
@ -244,9 +247,6 @@ void LogicSnapshot::append_cross_payload(
|
||||
_block_num++;
|
||||
}
|
||||
|
||||
_src_ptr = logic.data;
|
||||
uint64_t len = logic.length;
|
||||
|
||||
// bit align
|
||||
while (((_ch_fraction != 0) || (_byte_fraction != 0)) && (len != 0)) {
|
||||
uint8_t *dp_tmp = (uint8_t *)_dest_ptr;
|
||||
@ -378,10 +378,12 @@ void LogicSnapshot::append_split_payload(
|
||||
if (_sample_cnt[order] >= _total_sample_count)
|
||||
return;
|
||||
|
||||
if (_sample_cnt[order] + samples < _total_sample_count)
|
||||
if (_sample_cnt[order] + samples < _total_sample_count) {
|
||||
_sample_cnt[order] += samples;
|
||||
else
|
||||
} else {
|
||||
samples = _total_sample_count - _sample_cnt[order];
|
||||
_sample_cnt[order] = _total_sample_count;
|
||||
}
|
||||
|
||||
while (_sample_cnt[order] > _block_cnt[order] * LeafBlockSamples) {
|
||||
uint8_t index0 = _block_cnt[order] / RootScale;
|
||||
|
@ -37,7 +37,7 @@ StoreProgress::StoreProgress(SigSession &session, QWidget *parent) :
|
||||
|
||||
_info.setText("...");
|
||||
_progress.setValue(0);
|
||||
_progress.setMaximum(0);
|
||||
_progress.setMaximum(100);
|
||||
|
||||
QVBoxLayout* add_layout = new QVBoxLayout(this);
|
||||
add_layout->addWidget(&_info, 0, Qt::AlignCenter);
|
||||
@ -114,9 +114,8 @@ void StoreProgress::on_progress_updated()
|
||||
{
|
||||
const std::pair<uint64_t, uint64_t> p = _store_session.progress();
|
||||
assert(p.first <= p.second);
|
||||
|
||||
_progress.setValue(p.first);
|
||||
_progress.setMaximum(p.second);
|
||||
int percent = p.first * 1.0 / p.second * 100;
|
||||
_progress.setValue(percent);
|
||||
|
||||
const QString err = _store_session.error();
|
||||
if (!err.isEmpty()) {
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user