forked from Ivasoft/DSView
Fix RLE trigger issue @LA mode
This commit is contained in:
@@ -225,6 +225,7 @@ void SamplingBar::on_configure()
|
||||
if (ret == QDialog::Accepted) {
|
||||
device_updated();
|
||||
update_sample_rate_selector();
|
||||
commit_sample_rate();
|
||||
}
|
||||
|
||||
GVariant* gvar = dev_inst->get_config(NULL, NULL, SR_CONF_ZERO);
|
||||
@@ -294,7 +295,7 @@ void SamplingBar::update_record_length()
|
||||
disconnect(&_sample_count, SIGNAL(currentIndexChanged(int)),
|
||||
this, SLOT(on_samplecount_sel(int)));
|
||||
|
||||
update_sample_count_selector_value();
|
||||
update_sample_count_selector();
|
||||
|
||||
connect(&_sample_count, SIGNAL(currentIndexChanged(int)),
|
||||
this, SLOT(on_samplecount_sel(int)));
|
||||
@@ -305,7 +306,7 @@ void SamplingBar::update_sample_rate()
|
||||
disconnect(&_sample_rate, SIGNAL(currentIndexChanged(int)),
|
||||
this, SLOT(on_samplerate_sel(int)));
|
||||
|
||||
update_sample_rate_selector_value();
|
||||
update_sample_rate_selector();
|
||||
|
||||
connect(&_sample_rate, SIGNAL(currentIndexChanged(int)),
|
||||
this, SLOT(on_samplerate_sel(int)));
|
||||
@@ -452,7 +453,7 @@ void SamplingBar::update_sample_rate_selector_value()
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
update_scale();
|
||||
_updating_sample_rate = false;
|
||||
}
|
||||
|
||||
@@ -511,27 +512,27 @@ void SamplingBar::on_samplecount_sel(int index)
|
||||
g_variant_new_uint64(sample_count));
|
||||
|
||||
|
||||
GVariant* gvar = _devInst->get_config(NULL, NULL, SR_CONF_STREAM);
|
||||
if (gvar != NULL) {
|
||||
stream_mode = g_variant_get_boolean(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
gvar = _devInst->get_config(NULL, NULL, SR_CONF_MAX_LOGIC_SAMPLELIMITS);
|
||||
if (gvar != NULL) {
|
||||
max_sample_count = g_variant_get_uint64(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
if (!stream_mode) {
|
||||
if (sample_count > max_sample_count) {
|
||||
_devInst->set_config(NULL, NULL,
|
||||
SR_CONF_RLE,
|
||||
g_variant_new_boolean(true));
|
||||
} else {
|
||||
_devInst->set_config(NULL, NULL,
|
||||
SR_CONF_RLE,
|
||||
g_variant_new_boolean(false));
|
||||
}
|
||||
}
|
||||
// GVariant* gvar = _devInst->get_config(NULL, NULL, SR_CONF_STREAM);
|
||||
// if (gvar != NULL) {
|
||||
// stream_mode = g_variant_get_boolean(gvar);
|
||||
// g_variant_unref(gvar);
|
||||
// }
|
||||
// gvar = _devInst->get_config(NULL, NULL, SR_CONF_MAX_LOGIC_SAMPLELIMITS);
|
||||
// if (gvar != NULL) {
|
||||
// max_sample_count = g_variant_get_uint64(gvar);
|
||||
// g_variant_unref(gvar);
|
||||
// }
|
||||
// if (!stream_mode) {
|
||||
// if (sample_count > max_sample_count) {
|
||||
// _devInst->set_config(NULL, NULL,
|
||||
// SR_CONF_RLE,
|
||||
// g_variant_new_boolean(true));
|
||||
// } else {
|
||||
// _devInst->set_config(NULL, NULL,
|
||||
// SR_CONF_RLE,
|
||||
// g_variant_new_boolean(false));
|
||||
// }
|
||||
// }
|
||||
|
||||
sample_count_changed();
|
||||
update_scale();
|
||||
@@ -562,32 +563,32 @@ void SamplingBar::on_samplerate_sel(int index)
|
||||
SR_CONF_SAMPLERATE,
|
||||
g_variant_new_uint64(sample_rate));
|
||||
|
||||
GVariant* gvar = _devInst->get_config(NULL, NULL, SR_CONF_STREAM);
|
||||
if (gvar != NULL) {
|
||||
stream_mode = g_variant_get_boolean(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
gvar = _devInst->get_config(NULL, NULL, SR_CONF_LIMIT_SAMPLES);
|
||||
if (gvar != NULL) {
|
||||
sample_count = g_variant_get_uint64(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
gvar = _devInst->get_config(NULL, NULL, SR_CONF_MAX_LOGIC_SAMPLELIMITS);
|
||||
if (gvar != NULL) {
|
||||
max_sample_count = g_variant_get_uint64(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
if (!stream_mode) {
|
||||
if (sample_count > max_sample_count) {
|
||||
_devInst->set_config(NULL, NULL,
|
||||
SR_CONF_RLE,
|
||||
g_variant_new_boolean(true));
|
||||
} else {
|
||||
_devInst->set_config(NULL, NULL,
|
||||
SR_CONF_RLE,
|
||||
g_variant_new_boolean(false));
|
||||
}
|
||||
}
|
||||
// GVariant* gvar = _devInst->get_config(NULL, NULL, SR_CONF_STREAM);
|
||||
// if (gvar != NULL) {
|
||||
// stream_mode = g_variant_get_boolean(gvar);
|
||||
// g_variant_unref(gvar);
|
||||
// }
|
||||
// gvar = _devInst->get_config(NULL, NULL, SR_CONF_LIMIT_SAMPLES);
|
||||
// if (gvar != NULL) {
|
||||
// sample_count = g_variant_get_uint64(gvar);
|
||||
// g_variant_unref(gvar);
|
||||
// }
|
||||
// gvar = _devInst->get_config(NULL, NULL, SR_CONF_MAX_LOGIC_SAMPLELIMITS);
|
||||
// if (gvar != NULL) {
|
||||
// max_sample_count = g_variant_get_uint64(gvar);
|
||||
// g_variant_unref(gvar);
|
||||
// }
|
||||
// if (!stream_mode) {
|
||||
// if (sample_count > max_sample_count) {
|
||||
// _devInst->set_config(NULL, NULL,
|
||||
// SR_CONF_RLE,
|
||||
// g_variant_new_boolean(true));
|
||||
// } else {
|
||||
// _devInst->set_config(NULL, NULL,
|
||||
// SR_CONF_RLE,
|
||||
// g_variant_new_boolean(false));
|
||||
// }
|
||||
// }
|
||||
|
||||
update_scale();
|
||||
}
|
||||
@@ -664,6 +665,7 @@ void SamplingBar::update_sample_count_selector_value()
|
||||
|
||||
_updating_sample_count = false;
|
||||
sample_count_changed();
|
||||
update_scale();
|
||||
}
|
||||
|
||||
void SamplingBar::commit_sample_count()
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1429,6 +1429,12 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
|
||||
ret = command_dso_ctrl(usb->devhdl, dso_cmd_gen(sdi, 0, SR_CONF_SAMPLERATE));
|
||||
} else {
|
||||
devc->sample_wide = (devc->cur_samplerate <= DSLOGIC_MAX_LOGIC_SAMPLERATE);
|
||||
if (!devc->stream) {
|
||||
if (devc->limit_samples > DSLOGIC_MAX_LOGIC_DEPTH*ceil(devc->cur_samplerate * 1.0 / DSLOGIC_MAX_LOGIC_SAMPLERATE))
|
||||
devc->rle_mode = TRUE;
|
||||
else
|
||||
devc->rle_mode = FALSE;
|
||||
}
|
||||
ret = SR_OK;
|
||||
}
|
||||
} else if (id == SR_CONF_CLOCK_TYPE) {
|
||||
@@ -1459,6 +1465,14 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
|
||||
ret = SR_OK;
|
||||
} else if (id == SR_CONF_LIMIT_SAMPLES) {
|
||||
devc->limit_samples = g_variant_get_uint64(data);
|
||||
if(sdi->mode == LOGIC) {
|
||||
if (!devc->stream) {
|
||||
if (devc->limit_samples > DSLOGIC_MAX_LOGIC_DEPTH*ceil(devc->cur_samplerate * 1.0 / DSLOGIC_MAX_LOGIC_SAMPLERATE))
|
||||
devc->rle_mode = TRUE;
|
||||
else
|
||||
devc->rle_mode = FALSE;
|
||||
}
|
||||
}
|
||||
ret = SR_OK;
|
||||
} else if (id == SR_CONF_DEVICE_MODE) {
|
||||
sdi->mode = g_variant_get_int16(data);
|
||||
@@ -1574,6 +1588,7 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
|
||||
} else if (!strcmp(stropt, opmodes[SR_OP_STREAM]) && (devc->op_mode != SR_OP_STREAM)) {
|
||||
devc->op_mode = SR_OP_STREAM;
|
||||
devc->stream = TRUE;
|
||||
devc->rle_mode = FALSE;
|
||||
devc->ch_mode = 0;
|
||||
devc->samplerates_size = 10;
|
||||
adjust_probes(sdi, stream_ch_num[0]);
|
||||
@@ -1585,6 +1600,7 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
|
||||
adjust_probes(sdi, buffer_ch_num[0]);
|
||||
devc->limit_samples = DSLOGIC_MAX_LOGIC_DEPTH;
|
||||
devc->cur_samplerate = DSLOGIC_MAX_LOGIC_SAMPLERATE;
|
||||
devc->sample_wide = TRUE;
|
||||
} else if (!strcmp(stropt, opmodes[SR_OP_EXTERNAL_TEST]) && (devc->op_mode != SR_OP_EXTERNAL_TEST)) {
|
||||
devc->op_mode = SR_OP_EXTERNAL_TEST;
|
||||
devc->stream = FALSE;
|
||||
@@ -1593,6 +1609,7 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
|
||||
adjust_probes(sdi, buffer_ch_num[0]);
|
||||
devc->limit_samples = DSLOGIC_MAX_LOGIC_DEPTH;
|
||||
devc->cur_samplerate = DSLOGIC_MAX_LOGIC_SAMPLERATE;
|
||||
devc->sample_wide = TRUE;
|
||||
} else if (!strcmp(stropt, opmodes[SR_OP_LOOPBACK_TEST]) && (devc->op_mode != SR_OP_LOOPBACK_TEST)) {
|
||||
devc->op_mode = SR_OP_LOOPBACK_TEST;
|
||||
devc->stream = FALSE;
|
||||
@@ -1601,11 +1618,14 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
|
||||
adjust_probes(sdi, buffer_ch_num[0]);
|
||||
devc->limit_samples = DSLOGIC_MAX_LOGIC_DEPTH;
|
||||
devc->cur_samplerate = DSLOGIC_MAX_LOGIC_SAMPLERATE;
|
||||
devc->sample_wide = TRUE;
|
||||
} else {
|
||||
ret = SR_ERR;
|
||||
}
|
||||
if (devc->cur_samplerate > samplerates[devc->samplerates_size-1])
|
||||
if (devc->cur_samplerate > samplerates[devc->samplerates_size-1]) {
|
||||
devc->cur_samplerate = samplerates[devc->samplerates_size-1];
|
||||
devc->sample_wide = (devc->cur_samplerate <= DSLOGIC_MAX_DSO_SAMPLERATE);
|
||||
}
|
||||
}
|
||||
sr_dbg("%s: setting pattern to %d",
|
||||
__func__, devc->op_mode);
|
||||
@@ -1630,8 +1650,10 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (devc->cur_samplerate > samplerates[devc->samplerates_size-1])
|
||||
if (devc->cur_samplerate > samplerates[devc->samplerates_size-1]) {
|
||||
devc->cur_samplerate = samplerates[devc->samplerates_size-1];
|
||||
devc->sample_wide = (devc->cur_samplerate <= DSLOGIC_MAX_DSO_SAMPLERATE);
|
||||
}
|
||||
}
|
||||
sr_dbg("%s: setting channel mode to %d",
|
||||
__func__, devc->ch_mode);
|
||||
@@ -2468,8 +2490,9 @@ static void receive_trigger_pos(struct libusb_transfer *transfer)
|
||||
switch (transfer->status) {
|
||||
case LIBUSB_TRANSFER_COMPLETED:
|
||||
if (transfer->actual_length == sizeof(struct ds_trigger_pos)) {
|
||||
if (trigger_pos->remain_cnt < devc->limit_samples) {
|
||||
devc->actual_samples = (devc->limit_samples - ceil(devc->cur_samplerate * 1.0 / DSLOGIC_MAX_LOGIC_SAMPLERATE) * (trigger_pos->remain_cnt + devc->rle_mode));
|
||||
if (devc->stream || trigger_pos->remain_cnt < devc->limit_samples) {
|
||||
if (!devc->stream)
|
||||
devc->actual_samples = (devc->limit_samples - ceil(devc->cur_samplerate * 1.0 / DSLOGIC_MAX_LOGIC_SAMPLERATE) * (trigger_pos->remain_cnt));
|
||||
|
||||
packet.type = SR_DF_TRIGGER;
|
||||
packet.payload = trigger_pos;
|
||||
|
||||
Reference in New Issue
Block a user