forked from Ivasoft/DSView
fix data error when enable/disable channel @ DSO mode
This commit is contained in:
@@ -105,6 +105,7 @@ DeviceOptions::DeviceOptions(struct sr_dev_inst *sdi) :
|
||||
case SR_CONF_CLOCK_TYPE:
|
||||
case SR_CONF_CLOCK_EDGE:
|
||||
case SR_CONF_INSTANT:
|
||||
case SR_CONF_DATALOCK:
|
||||
bind_bool(name, key);
|
||||
break;
|
||||
|
||||
|
||||
@@ -209,6 +209,8 @@ void DsoSignal::set_enable(bool enable)
|
||||
get_index() == 0)
|
||||
return;
|
||||
_view->session().refresh(INT_MAX);
|
||||
_dev_inst->set_config(_probe, NULL, SR_CONF_DATALOCK,
|
||||
g_variant_new_boolean(true));
|
||||
set_vDialActive(false);
|
||||
_dev_inst->set_config(_probe, NULL, SR_CONF_EN_CH,
|
||||
g_variant_new_boolean(enable));
|
||||
@@ -240,8 +242,9 @@ void DsoSignal::set_enable(bool enable)
|
||||
|
||||
_view->set_sample_rate(sample_rate, true);
|
||||
_view->set_sample_limit(sample_limit, true);
|
||||
_view->set_need_update(true);
|
||||
_view->update();
|
||||
|
||||
_dev_inst->set_config(_probe, NULL, SR_CONF_DATALOCK,
|
||||
g_variant_new_boolean(false));
|
||||
_view->session().refresh(800);
|
||||
}
|
||||
|
||||
@@ -851,7 +854,7 @@ void DsoSignal::paint_trace(QPainter &p,
|
||||
assert(samples);
|
||||
|
||||
QColor trace_colour = _colour;
|
||||
trace_colour.setAlpha(100);
|
||||
trace_colour.setAlpha(150);
|
||||
p.setPen(trace_colour);
|
||||
//p.setPen(QPen(_colour, 3, Qt::SolidLine));
|
||||
|
||||
|
||||
@@ -589,6 +589,7 @@ static struct DSL_context *DSCope_dev_new(void)
|
||||
devc->trigger_hpos = 0x0;
|
||||
devc->trigger_hrate = 0;
|
||||
devc->zero = FALSE;
|
||||
devc->data_lock = FALSE;
|
||||
|
||||
return devc;
|
||||
}
|
||||
@@ -1226,6 +1227,12 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
||||
return SR_ERR;
|
||||
*data = g_variant_new_boolean(ch->enabled);
|
||||
break;
|
||||
case SR_CONF_DATALOCK:
|
||||
if (!sdi)
|
||||
return SR_ERR;
|
||||
devc = sdi->priv;
|
||||
*data = g_variant_new_boolean(devc->data_lock);
|
||||
break;
|
||||
case SR_CONF_TRIGGER_SLOPE:
|
||||
if (!sdi)
|
||||
return SR_ERR;
|
||||
@@ -1454,6 +1461,9 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
|
||||
else
|
||||
sr_dbg("%s: setting ENABLE of channel %d to %d",
|
||||
__func__, ch->index, ch->enabled);
|
||||
} else if (id == SR_CONF_DATALOCK) {
|
||||
devc->data_lock = g_variant_get_boolean(data);
|
||||
ret = SR_OK;
|
||||
} else if (id == SR_CONF_VDIV) {
|
||||
ch->vdiv = g_variant_get_uint64(data);
|
||||
if (sdi->mode == DSO) {
|
||||
@@ -1810,7 +1820,9 @@ static void receive_transfer(struct libusb_transfer *transfer)
|
||||
break;
|
||||
}
|
||||
|
||||
if (transfer->actual_length == 0 || packet_has_error) {
|
||||
if (transfer->actual_length == 0 ||
|
||||
packet_has_error ||
|
||||
devc->data_lock) {
|
||||
devc->empty_transfer_count++;
|
||||
if (devc->empty_transfer_count > MAX_EMPTY_TRANSFERS) {
|
||||
/*
|
||||
|
||||
@@ -172,7 +172,7 @@ struct DSL_context {
|
||||
uint32_t trigger_holdoff;
|
||||
gboolean zero;
|
||||
gboolean stream;
|
||||
gboolean lock;
|
||||
gboolean data_lock;
|
||||
|
||||
int num_samples;
|
||||
int submitted_transfers;
|
||||
|
||||
@@ -659,6 +659,7 @@ static struct DSL_context *DSLogic_dev_new(void)
|
||||
devc->zero = FALSE;
|
||||
devc->stream = FALSE;
|
||||
devc->mstatus_valid = FALSE;
|
||||
devc->data_lock = FALSE;
|
||||
|
||||
return devc;
|
||||
}
|
||||
@@ -1233,6 +1234,12 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
||||
return SR_ERR;
|
||||
*data = g_variant_new_boolean(ch->enabled);
|
||||
break;
|
||||
case SR_CONF_DATALOCK:
|
||||
if (!sdi)
|
||||
return SR_ERR;
|
||||
devc = sdi->priv;
|
||||
*data = g_variant_new_boolean(devc->data_lock);
|
||||
break;
|
||||
case SR_CONF_TRIGGER_SLOPE:
|
||||
if (!sdi)
|
||||
return SR_ERR;
|
||||
@@ -1582,6 +1589,9 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
|
||||
else
|
||||
sr_dbg("%s: setting ENABLE of channel %d to %d",
|
||||
__func__, ch->index, ch->enabled);
|
||||
} else if (id == SR_CONF_DATALOCK) {
|
||||
devc->data_lock = g_variant_get_boolean(data);
|
||||
ret = SR_OK;
|
||||
} else if (id == SR_CONF_VDIV) {
|
||||
ch->vdiv = g_variant_get_uint64(data);
|
||||
if (sdi->mode == DSO) {
|
||||
@@ -1931,7 +1941,9 @@ static void receive_transfer(struct libusb_transfer *transfer)
|
||||
break;
|
||||
}
|
||||
|
||||
if (transfer->actual_length == 0 || packet_has_error) {
|
||||
if (transfer->actual_length == 0 ||
|
||||
packet_has_error ||
|
||||
devc->data_lock) {
|
||||
devc->empty_transfer_count++;
|
||||
if (devc->empty_transfer_count > MAX_EMPTY_TRANSFERS) {
|
||||
/*
|
||||
|
||||
@@ -99,6 +99,7 @@ struct dev_context {
|
||||
int stop;
|
||||
uint64_t timebase;
|
||||
gboolean instant;
|
||||
gboolean data_lock;
|
||||
|
||||
int trigger_stage;
|
||||
uint16_t trigger_mask;
|
||||
@@ -232,6 +233,7 @@ static GSList *hw_scan(GSList *options)
|
||||
devc->limit_msec = 0;
|
||||
devc->sample_generator = PATTERN_SINE;
|
||||
devc->timebase = 10000;
|
||||
devc->data_lock = FALSE;
|
||||
|
||||
sdi->priv = devc;
|
||||
|
||||
@@ -368,6 +370,9 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
||||
case SR_CONF_EN_CH:
|
||||
*data = g_variant_new_uint64(ch->enabled);
|
||||
break;
|
||||
case SR_CONF_DATALOCK:
|
||||
*data = g_variant_new_boolean(devc->data_lock);
|
||||
break;
|
||||
case SR_CONF_MAX_DSO_SAMPLERATE:
|
||||
*data = g_variant_new_uint64(DEMO_MAX_DSO_SAMPLERATE);
|
||||
break;
|
||||
@@ -461,7 +466,7 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
|
||||
}
|
||||
sr_dbg("%s: setting mode to %d", __func__, sdi->mode);
|
||||
}else if (id == SR_CONF_PATTERN_MODE) {
|
||||
stropt = g_variant_get_string(data, NULL);
|
||||
stropt = g_variant_get_string(data, NULL);
|
||||
ret = SR_OK;
|
||||
if (!strcmp(stropt, pattern_strings[PATTERN_SINE])) {
|
||||
devc->sample_generator = PATTERN_SINE;
|
||||
@@ -492,6 +497,11 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
|
||||
sr_dbg("%s: setting ENABLE of channel %d to %d", __func__,
|
||||
ch->index, ch->enabled);
|
||||
ret = SR_OK;
|
||||
} else if (id == SR_CONF_DATALOCK) {
|
||||
devc->data_lock = g_variant_get_boolean(data);
|
||||
sr_dbg("%s: setting data lock to %d", __func__,
|
||||
devc->data_lock);
|
||||
ret = SR_OK;
|
||||
} else if (id == SR_CONF_VDIV) {
|
||||
ch->vdiv = g_variant_get_uint64(data);
|
||||
sr_dbg("%s: setting VDIV of channel %d to %" PRIu64, __func__,
|
||||
|
||||
@@ -774,6 +774,9 @@ enum {
|
||||
/** Channel enable for dso channel. */
|
||||
SR_CONF_EN_CH,
|
||||
|
||||
/** Data lock */
|
||||
SR_CONF_DATALOCK,
|
||||
|
||||
/** probe factor for dso channel. */
|
||||
SR_CONF_FACTOR,
|
||||
|
||||
|
||||
Reference in New Issue
Block a user