forked from Ivasoft/DSView
Limit trigger position less than hardware depth
This commit is contained in:
@@ -487,23 +487,33 @@ void TriggerDock::pos_changed(int pos)
|
||||
|
||||
void TriggerDock::device_change()
|
||||
{
|
||||
bool stream = false;
|
||||
GVariant *gvar = _session.get_device()->get_config(NULL, NULL, SR_CONF_STREAM);
|
||||
uint64_t max_hd_depth;
|
||||
bool stream;
|
||||
uint8_t maxRange;
|
||||
uint64_t sample_limits;
|
||||
GVariant *gvar = _session.get_device()->get_config(NULL, NULL, SR_CONF_MAX_LOGIC_SAMPLELIMITS);
|
||||
if (gvar != NULL) {
|
||||
stream = g_variant_get_boolean(gvar);
|
||||
max_hd_depth = g_variant_get_uint64(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
|
||||
if (stream &&
|
||||
strcmp(_session.get_device()->dev_inst()->driver->name, "DSLogic") == 0) {
|
||||
const int maxRange = SR_MB(11)*100/_session.get_device()->get_sample_limit();
|
||||
position_spinBox->setRange(0, maxRange);
|
||||
position_slider->setRange(0, maxRange);
|
||||
simple_radioButton->setChecked(true);
|
||||
simple_trigger();
|
||||
} else {
|
||||
position_spinBox->setRange(0, 99);
|
||||
position_slider->setRange(0, 99);
|
||||
if (_session.get_device()->dev_inst()->mode == LOGIC) {
|
||||
sample_limits = _session.get_device()->get_sample_limit();
|
||||
if (max_hd_depth >= sample_limits)
|
||||
maxRange = 99;
|
||||
else
|
||||
maxRange = max_hd_depth*70 / sample_limits;
|
||||
position_spinBox->setRange(0, maxRange);
|
||||
position_slider->setRange(0, maxRange);
|
||||
simple_radioButton->setChecked(true);
|
||||
|
||||
gvar = _session.get_device()->get_config(NULL, NULL, SR_CONF_STREAM);
|
||||
if (gvar != NULL) {
|
||||
stream = g_variant_get_boolean(gvar);
|
||||
g_variant_unref(gvar);
|
||||
if (stream)
|
||||
simple_trigger();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -61,8 +61,6 @@ public:
|
||||
|
||||
void paintEvent(QPaintEvent *);
|
||||
|
||||
void device_change();
|
||||
|
||||
void init();
|
||||
|
||||
QJsonObject get_session();
|
||||
@@ -86,6 +84,8 @@ public slots:
|
||||
void adv_tog(int index);
|
||||
void serial_channel_changed(int index);
|
||||
|
||||
void device_change();
|
||||
|
||||
private:
|
||||
|
||||
private:
|
||||
|
||||
@@ -192,6 +192,8 @@ void MainWindow::setup_ui()
|
||||
SLOT(instant_stop()));
|
||||
connect(_sampling_bar, SIGNAL(update_scale()), _view,
|
||||
SLOT(update_scale()), Qt::DirectConnection);
|
||||
connect(_sampling_bar, SIGNAL(sample_count_changed()), _trigger_widget,
|
||||
SLOT(device_change()));
|
||||
connect(_dso_trigger_widget, SIGNAL(set_trig_pos(quint64)), _view,
|
||||
SLOT(set_trig_pos(quint64)));
|
||||
|
||||
|
||||
@@ -493,10 +493,7 @@ void SamplingBar::on_samplecount_sel(int index)
|
||||
{
|
||||
uint64_t sample_count = 0;
|
||||
uint64_t max_sample_count = 0;
|
||||
//uint64_t last_sample_count = 0;
|
||||
bool stream_mode = false;
|
||||
//bool buffer2stream = false;
|
||||
//bool stream2buffer = false;
|
||||
|
||||
qDebug() << "index: " << index;
|
||||
if (index >= 0)
|
||||
@@ -505,52 +502,25 @@ void SamplingBar::on_samplecount_sel(int index)
|
||||
|
||||
boost::shared_ptr<pv::device::DevInst> _devInst = get_selected_device();
|
||||
assert(_devInst);
|
||||
qDebug() << "1!\n";
|
||||
if (strcmp(_devInst->dev_inst()->driver->name, "DSLogic") == 0 && _devInst->dev_inst()->mode != DSO) {
|
||||
/*GVariant* gvar = _devInst->get_config(NULL, NULL, SR_CONF_LIMIT_SAMPLES);
|
||||
if (gvar != NULL) {
|
||||
last_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);
|
||||
}
|
||||
gvar = _devInst->get_config(NULL, NULL, SR_CONF_STREAM);
|
||||
if (gvar != NULL) {
|
||||
stream_mode = g_variant_get_boolean(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
|
||||
if (((!stream_mode || (last_sample_count >= SR_GB(1))) && sample_count > max_sample_count) ||
|
||||
(sample_count >= SR_GB(1) && _devInst->get_sample_rate() <= SR_MHZ(10))) {
|
||||
stream_mode = sample_count > max_sample_count;
|
||||
buffer2stream = true;
|
||||
} else if (stream_mode && sample_count <= max_sample_count) {
|
||||
stream_mode = sample_count > max_sample_count;
|
||||
stream2buffer = true;
|
||||
}*/
|
||||
qDebug() << "2!\n";
|
||||
if (strcmp(_devInst->dev_inst()->driver->name, "DSLogic") == 0 && _devInst->dev_inst()->mode != DSO) {
|
||||
|
||||
// Set the sample count
|
||||
_devInst->set_config(NULL, NULL,
|
||||
SR_CONF_LIMIT_SAMPLES,
|
||||
g_variant_new_uint64(sample_count));
|
||||
|
||||
qDebug() << "21!\n";
|
||||
|
||||
GVariant* gvar = _devInst->get_config(NULL, NULL, SR_CONF_STREAM);
|
||||
if (gvar != NULL) {
|
||||
stream_mode = g_variant_get_boolean(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
qDebug() << "22!\n";
|
||||
gvar = _devInst->get_config(NULL, NULL, SR_CONF_MAX_LOGIC_SAMPLELIMITS);
|
||||
qDebug() << "23!\n";
|
||||
if (gvar != NULL) {
|
||||
max_sample_count = g_variant_get_uint64(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
qDebug() << "3!\n";
|
||||
if (!stream_mode) {
|
||||
if (sample_count > max_sample_count) {
|
||||
_devInst->set_config(NULL, NULL,
|
||||
@@ -562,27 +532,8 @@ qDebug() << "21!\n";
|
||||
g_variant_new_boolean(false));
|
||||
}
|
||||
}
|
||||
qDebug() << "4!\n";
|
||||
/*if (buffer2stream) {
|
||||
pv::dialogs::StreamOptions stream(this, _devInst, sample_count, stream_mode);
|
||||
stream.setFixedSize(300, 150);
|
||||
stream.exec();
|
||||
update_sample_rate_selector_value();
|
||||
update_sample_count_selector_value();
|
||||
_devInst->set_config(NULL, NULL,
|
||||
SR_CONF_STREAM,
|
||||
g_variant_new_boolean(true));
|
||||
} else if (stream2buffer) {
|
||||
QMessageBox msg(this);
|
||||
pv::dialogs::StreamOptions stream(this, _devInst, sample_count, stream_mode);
|
||||
stream.setFixedSize(300, 100);
|
||||
stream.exec();
|
||||
_devInst->set_config(NULL, NULL,
|
||||
SR_CONF_STREAM,
|
||||
g_variant_new_boolean(false));
|
||||
}
|
||||
|
||||
device_updated();*/
|
||||
sample_count_changed();
|
||||
update_scale();
|
||||
}
|
||||
}
|
||||
@@ -712,6 +663,7 @@ void SamplingBar::update_sample_count_selector_value()
|
||||
_sample_count.setCurrentIndex(i);
|
||||
|
||||
_updating_sample_count = false;
|
||||
sample_count_changed();
|
||||
}
|
||||
|
||||
void SamplingBar::commit_sample_count()
|
||||
|
||||
@@ -96,6 +96,7 @@ signals:
|
||||
void device_selected();
|
||||
void device_updated();
|
||||
void update_scale();
|
||||
void sample_count_changed();
|
||||
|
||||
private:
|
||||
void update_sample_rate_selector();
|
||||
|
||||
@@ -72,7 +72,7 @@ Viewport::Viewport(View &parent) :
|
||||
{
|
||||
setMouseTracking(true);
|
||||
setAutoFillBackground(true);
|
||||
setBackgroundRole(QPalette::Base);
|
||||
setBackgroundRole(QPalette::Base);
|
||||
|
||||
//setFixedSize(QSize(600, 400));
|
||||
_mm_width = "#####";
|
||||
|
||||
@@ -1376,13 +1376,8 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
||||
case SR_CONF_MAX_LOGIC_SAMPLELIMITS:
|
||||
if (!sdi)
|
||||
return SR_ERR;
|
||||
sr_spew("dslogic:before");
|
||||
devc = sdi->priv;
|
||||
sr_spew("DSLOGIC_MAX_LOGIC_DEPTH: %d", DSLOGIC_MAX_LOGIC_DEPTH);
|
||||
sr_spew("devc->cur_samplerate: %d", devc->cur_samplerate);
|
||||
sr_spew("DSLOGIC_MAX_LOGIC_SAMPLERATE: %d", DSLOGIC_MAX_LOGIC_SAMPLERATE);
|
||||
*data = g_variant_new_uint64(DSLOGIC_MAX_LOGIC_DEPTH*ceil(devc->cur_samplerate * 1.0 / DSLOGIC_MAX_LOGIC_SAMPLERATE));
|
||||
sr_spew("dslogic:after");
|
||||
break;
|
||||
case SR_CONF_STATUS:
|
||||
if (!sdi)
|
||||
|
||||
Reference in New Issue
Block a user