keep channel settings when reload @ LA mode

fix trigger setting @ LA stream mode
This commit is contained in:
DreamSourceLab 2015-05-07 14:14:53 +08:00
parent 6dc75374bd
commit f34c8b10ec
7 changed files with 53 additions and 42 deletions

View File

@ -369,11 +369,12 @@ void TriggerDock::device_change()
if (stream ||
strcmp(_session.get_device()->dev_inst()->driver->name, "DSLogic") != 0) {
position_spinBox->setDisabled(true);
position_slider->setDisabled(true);
const int maxRange = SR_MB(11)*100/_session.get_device()->get_sample_limit();
position_spinBox->setRange(0, maxRange);
position_slider->setRange(0, maxRange);
} else {
position_spinBox->setDisabled(false);
position_slider->setDisabled(false);
position_spinBox->setRange(0, 99);
position_slider->setRange(0, 99);
}
}

View File

@ -180,7 +180,7 @@ void MainWindow::setup_ui()
connect(_sampling_bar, SIGNAL(device_selected()), this,
SLOT(update_device_list()));
connect(_sampling_bar, SIGNAL(device_updated()), &_session,
connect(_sampling_bar, SIGNAL(device_updated()), this,
SLOT(reload()));
connect(_sampling_bar, SIGNAL(run_stop()), this,
SLOT(run_stop()));
@ -317,6 +317,12 @@ void MainWindow::update_device_list()
_logo_bar->dsl_connected(false);
}
void MainWindow::reload()
{
_trigger_widget->device_change();
_session.reload();
}
void MainWindow::load_file(QString file_name)
{
try {

View File

@ -90,6 +90,8 @@ private slots:
*/
void update_device_list();
void reload();
void show_session_error(
const QString text, const QString info_text);

View File

@ -667,19 +667,21 @@ void SamplingBar::on_run_stop()
const shared_ptr<device::DevInst> dev_inst = get_selected_device();
if (!dev_inst)
return;
GVariant* gvar = dev_inst->get_config(NULL, NULL, SR_CONF_ZERO);
if (gvar != NULL) {
bool zero = g_variant_get_boolean(gvar);
g_variant_unref(gvar);
if (zero) {
QMessageBox msg(this);
msg.setText("Zero Adjustment");
msg.setInformativeText("Please adjust zero skew and save the result!");
msg.setStandardButtons(QMessageBox::Ok);
msg.setIcon(QMessageBox::Warning);
msg.exec();
zero_adj();
return;
if (dev_inst->dev_inst()->mode == DSO) {
GVariant* gvar = dev_inst->get_config(NULL, NULL, SR_CONF_ZERO);
if (gvar != NULL) {
bool zero = g_variant_get_boolean(gvar);
g_variant_unref(gvar);
if (zero) {
QMessageBox msg(this);
msg.setText("Zero Adjustment");
msg.setInformativeText("Please adjust zero skew and save the result!");
msg.setStandardButtons(QMessageBox::Ok);
msg.setIcon(QMessageBox::Warning);
msg.exec();
zero_adj();
return;
}
}
}
run_stop();
@ -695,22 +697,24 @@ void SamplingBar::on_instant_stop()
const shared_ptr<device::DevInst> dev_inst = get_selected_device();
if (!dev_inst)
return;
GVariant* gvar = dev_inst->get_config(NULL, NULL, SR_CONF_ZERO);
if (gvar != NULL) {
bool zero = g_variant_get_boolean(gvar);
g_variant_unref(gvar);
if (zero) {
QMessageBox msg(this);
msg.setText("Zero Adjustment");
if(strcmp(dev_inst->dev_inst()->driver->name, "DSLogic") == 0)
msg.setInformativeText("Please adjust zero skew and save the result!\nPlease left both of channels unconnect for zero adjustment!");
else
msg.setInformativeText("Please adjust zero skew and save the result!");
msg.setStandardButtons(QMessageBox::Ok);
msg.setIcon(QMessageBox::Warning);
msg.exec();
zero_adj();
return;
if (dev_inst->dev_inst()->mode == DSO) {
GVariant* gvar = dev_inst->get_config(NULL, NULL, SR_CONF_ZERO);
if (gvar != NULL) {
bool zero = g_variant_get_boolean(gvar);
g_variant_unref(gvar);
if (zero) {
QMessageBox msg(this);
msg.setText("Zero Adjustment");
if(strcmp(dev_inst->dev_inst()->driver->name, "DSLogic") == 0)
msg.setInformativeText("Please adjust zero skew and save the result!\nPlease left both of channels unconnect for zero adjustment!");
else
msg.setInformativeText("Please adjust zero skew and save the result!");
msg.setStandardButtons(QMessageBox::Ok);
msg.setIcon(QMessageBox::Warning);
msg.exec();
zero_adj();
return;
}
}
}
instant_stop();

View File

@ -102,9 +102,8 @@ QString Ruler::format_freq(double period, unsigned precision)
} else {
const int order = ceil(log10f(period));
assert(order >= FirstSIPrefixPower);
const unsigned int prefix = ceil((order - FirstSIPrefixPower) / 3.0f);
const double multiplier = pow(10.0,
static_cast<double>(- prefix * 3 - FirstSIPrefixPower));
const int prefix = ceil((order - FirstSIPrefixPower) / 3.0f);
const double multiplier = pow(10.0, max(-prefix * 3.0 - FirstSIPrefixPower, 0.0));
QString s;
QTextStream ts(&s);
@ -115,11 +114,10 @@ QString Ruler::format_freq(double period, unsigned precision)
}
}
QString Ruler::format_time(double t, unsigned int prefix,
QString Ruler::format_time(double t, int prefix,
unsigned int precision)
{
const double multiplier = pow(10.0,
static_cast<double>(- prefix * 3 - FirstSIPrefixPower + 6));
const double multiplier = pow(10.0, -prefix * 3 - FirstSIPrefixPower + 6.0);
QString s;
QTextStream ts(&s);

View File

@ -63,7 +63,7 @@ public:
public:
Ruler(View &parent);
static QString format_time(double t, unsigned int prefix,
static QString format_time(double t, int prefix,
unsigned precision = pricision);
static QString format_freq(double period, unsigned precision = pricision);
QString format_time(double t);

View File

@ -320,7 +320,7 @@ void Viewport::paintProgress(QPainter &p)
if (triggred)
p.drawText(status_rect,
Qt::AlignCenter | Qt::AlignVCenter,
"Triggered! " + QString::number(captured_progress)+"% Captured");
"Triggered! " + QString::number(1-captured_progress)+"% Captured");
else
p.drawText(status_rect,
Qt::AlignCenter | Qt::AlignVCenter,