forked from Ivasoft/DSView
Improve the hardware abstraction layer
This commit is contained in:
@@ -273,9 +273,9 @@ void AnalogSnapshot::append_payload_to_envelope_levels()
|
||||
|
||||
// Break off if there are no new samples to compute
|
||||
if (e0.ring_length == prev_length)
|
||||
return;
|
||||
continue;
|
||||
if (e0.length == 0)
|
||||
return;
|
||||
continue;
|
||||
|
||||
reallocate_envelope(e0);
|
||||
|
||||
|
||||
@@ -174,7 +174,7 @@ void MathStack::calc_fft()
|
||||
boost::shared_ptr<pv::data::Dso> data;
|
||||
boost::shared_ptr<pv::view::DsoSignal> dsoSig;
|
||||
BOOST_FOREACH(const boost::shared_ptr<view::Signal> s, _session.get_signals()) {
|
||||
if (dsoSig = dynamic_pointer_cast<view::DsoSignal>(s)) {
|
||||
if ((dsoSig = dynamic_pointer_cast<view::DsoSignal>(s))) {
|
||||
if (dsoSig->get_index() == _index && dsoSig->enabled()) {
|
||||
data = dsoSig->dso_data();
|
||||
break;
|
||||
|
||||
@@ -69,12 +69,12 @@ QString Device::format_device_title() const
|
||||
|
||||
assert(_sdi);
|
||||
|
||||
if (_sdi->vendor && _sdi->vendor[0]) {
|
||||
s << _sdi->vendor;
|
||||
if ((_sdi->model && _sdi->model[0]) ||
|
||||
(_sdi->version && _sdi->version[0]))
|
||||
s << ' ';
|
||||
}
|
||||
// if (_sdi->vendor && _sdi->vendor[0]) {
|
||||
// s << _sdi->vendor;
|
||||
// if ((_sdi->model && _sdi->model[0]) ||
|
||||
// (_sdi->version && _sdi->version[0]))
|
||||
// s << ' ';
|
||||
// }
|
||||
|
||||
if (_sdi->model && _sdi->model[0]) {
|
||||
s << _sdi->model;
|
||||
|
||||
@@ -174,7 +174,7 @@ double DevInst::get_sample_time()
|
||||
return sample_time;
|
||||
}
|
||||
|
||||
GSList* DevInst::get_dev_mode_list()
|
||||
const GSList* DevInst::get_dev_mode_list()
|
||||
{
|
||||
assert(_owner);
|
||||
sr_dev_inst *const sdi = dev_inst();
|
||||
|
||||
@@ -107,7 +107,7 @@ public:
|
||||
* @return The returned device mode list from the driver, or NULL if the
|
||||
* mode list could not be read.
|
||||
*/
|
||||
GSList* get_dev_mode_list();
|
||||
const GSList *get_dev_mode_list();
|
||||
|
||||
/**
|
||||
* @brief Get the device name from the driver
|
||||
|
||||
@@ -58,8 +58,8 @@ About::About(QWidget *parent) :
|
||||
|
||||
QString thanks = tr("<font size=16>Special Thanks</font><br />"
|
||||
"<a href=\"%1\" style=\"color:#C0C0C0\">All backers on kickstarter</a><br />"
|
||||
"<a href=\"%1\" style=\"color:#C0C0C0\">All members of Sigrok project</a><br />"
|
||||
"All contributors of open-source projects</a><br />"
|
||||
"<a href=\"%2\" style=\"color:#C0C0C0\">All members of Sigrok project</a><br />"
|
||||
"All contributors of all open-source projects</a><br />"
|
||||
"<br /><br />")
|
||||
.arg("https://www.kickstarter.com/projects/dreamsourcelab/dslogic-multifunction-instruments-for-everyone")
|
||||
.arg("http://sigrok.org/");
|
||||
|
||||
@@ -48,10 +48,11 @@ DeviceOptions::DeviceOptions(QWidget *parent, boost::shared_ptr<pv::device::DevI
|
||||
_props_box->setLayout(get_property_form(_props_box));
|
||||
_layout.addWidget(_props_box);
|
||||
|
||||
QGroupBox *dynamic_box = new QGroupBox(dynamic_widget(_dynamic_layout),
|
||||
_dynamic_box = new QGroupBox(dynamic_widget(_dynamic_layout),
|
||||
this);
|
||||
dynamic_box->setLayout(&_dynamic_layout);
|
||||
_layout.addWidget(dynamic_box);
|
||||
_dynamic_box->setLayout(&_dynamic_layout);
|
||||
_layout.addWidget(_dynamic_box);
|
||||
_dynamic_box->setVisible(_dynamic_box->title() != NULL);
|
||||
|
||||
_layout.addStretch(1);
|
||||
_layout.addWidget(&_button_box);
|
||||
@@ -333,6 +334,7 @@ void DeviceOptions::mode_check()
|
||||
|
||||
if (mode != _mode) {
|
||||
dynamic_widget(_dynamic_layout);
|
||||
_dynamic_box->setVisible(_dynamic_box->title() != NULL);
|
||||
_mode = mode;
|
||||
}
|
||||
}
|
||||
@@ -356,9 +358,12 @@ void DeviceOptions::mode_check()
|
||||
void DeviceOptions::channel_check()
|
||||
{
|
||||
QRadioButton* sc=dynamic_cast<QRadioButton*>(sender());
|
||||
QString text = sc->text();
|
||||
text.remove('&');
|
||||
if(sc != NULL)
|
||||
_dev_inst->set_config(NULL, NULL, SR_CONF_CHANNEL_MODE, g_variant_new_string(sc->text().toUtf8().data()));
|
||||
_dev_inst->set_config(NULL, NULL, SR_CONF_CHANNEL_MODE, g_variant_new_string(text.toUtf8().data()));
|
||||
dynamic_widget(_dynamic_layout);
|
||||
_dynamic_box->setVisible(_dynamic_box->title() != NULL);
|
||||
}
|
||||
|
||||
void DeviceOptions::channel_enable()
|
||||
@@ -424,20 +429,27 @@ QString DeviceOptions::dynamic_widget(QGridLayout& inner_layout) {
|
||||
logic_probes(inner_layout);
|
||||
return tr("Channels");
|
||||
} else if (_dev_inst->dev_inst()->mode == DSO) {
|
||||
_config_button = new QPushButton(tr("Auto Calibration"), this);
|
||||
inner_layout.addWidget(_config_button, 0, 0, 1, 1);
|
||||
connect(_config_button, SIGNAL(clicked()), this, SLOT(zero_adj()));
|
||||
_cali_button = new QPushButton(tr("Manual Calibration"), this);
|
||||
inner_layout.addWidget(_cali_button, 1, 0, 1, 1);
|
||||
connect(_cali_button, SIGNAL(clicked()), this, SLOT(on_calibration()));
|
||||
GVariant* gvar = _dev_inst->get_config(NULL, NULL, SR_CONF_HAVE_ZERO);
|
||||
if (gvar != NULL) {
|
||||
bool have_zero = g_variant_get_boolean(gvar);
|
||||
g_variant_unref(gvar);
|
||||
|
||||
return tr("Calibration");
|
||||
if (have_zero) {
|
||||
_config_button = new QPushButton(tr("Auto Calibration"), this);
|
||||
inner_layout.addWidget(_config_button, 0, 0, 1, 1);
|
||||
connect(_config_button, SIGNAL(clicked()), this, SLOT(zero_adj()));
|
||||
_cali_button = new QPushButton(tr("Manual Calibration"), this);
|
||||
inner_layout.addWidget(_cali_button, 1, 0, 1, 1);
|
||||
connect(_cali_button, SIGNAL(clicked()), this, SLOT(on_calibration()));
|
||||
|
||||
return tr("Calibration");
|
||||
}
|
||||
}
|
||||
} else if (_dev_inst->dev_inst()->mode == ANALOG) {
|
||||
analog_probes(inner_layout);
|
||||
return tr("Channels");
|
||||
} else {
|
||||
return tr("Undefined");
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void DeviceOptions::analog_probes(QGridLayout &layout)
|
||||
|
||||
@@ -86,6 +86,7 @@ private:
|
||||
QVBoxLayout _layout;
|
||||
toolbars::TitleBar *_titlebar;
|
||||
|
||||
QGroupBox *_dynamic_box;
|
||||
QGridLayout _dynamic_layout;
|
||||
QVector <QLabel *> _probes_label_list;
|
||||
QVector <QCheckBox *> _probes_checkBox_list;
|
||||
|
||||
@@ -57,7 +57,7 @@ FftOptions::FftOptions(QWidget *parent, SigSession &session) :
|
||||
// setup _ch_combobox
|
||||
BOOST_FOREACH(const boost::shared_ptr<view::Signal> s, _session.get_signals()) {
|
||||
boost::shared_ptr<view::DsoSignal> dsoSig;
|
||||
if (dsoSig = dynamic_pointer_cast<view::DsoSignal>(s)) {
|
||||
if ((dsoSig = dynamic_pointer_cast<view::DsoSignal>(s))) {
|
||||
_ch_combobox->addItem(dsoSig->get_name(), qVariantFromValue(dsoSig->get_index()));
|
||||
}
|
||||
}
|
||||
@@ -77,7 +77,7 @@ FftOptions::FftOptions(QWidget *parent, SigSession &session) :
|
||||
std::vector<int> dbv_ranges;
|
||||
BOOST_FOREACH(const boost::shared_ptr<view::Trace> t, _session.get_math_signals()) {
|
||||
boost::shared_ptr<view::MathTrace> mathTrace;
|
||||
if (mathTrace = dynamic_pointer_cast<view::MathTrace>(t)) {
|
||||
if ((mathTrace = dynamic_pointer_cast<view::MathTrace>(t))) {
|
||||
windows = mathTrace->get_math_stack()->get_windows_support();
|
||||
length = mathTrace->get_math_stack()->get_length_support();
|
||||
view_modes = mathTrace->get_view_modes_support();
|
||||
@@ -127,7 +127,7 @@ FftOptions::FftOptions(QWidget *parent, SigSession &session) :
|
||||
// load current settings
|
||||
BOOST_FOREACH(const boost::shared_ptr<view::Trace> t, _session.get_math_signals()) {
|
||||
boost::shared_ptr<view::MathTrace> mathTrace;
|
||||
if (mathTrace = dynamic_pointer_cast<view::MathTrace>(t)) {
|
||||
if ((mathTrace = dynamic_pointer_cast<view::MathTrace>(t))) {
|
||||
if (mathTrace->enabled()) {
|
||||
_en_checkbox->setChecked(true);
|
||||
for (int i = 0; i < _ch_combobox->count(); i++) {
|
||||
@@ -216,7 +216,7 @@ void FftOptions::accept()
|
||||
|
||||
BOOST_FOREACH(const boost::shared_ptr<view::Trace> t, _session.get_math_signals()) {
|
||||
boost::shared_ptr<view::MathTrace> mathTrace;
|
||||
if (mathTrace = dynamic_pointer_cast<view::MathTrace>(t)) {
|
||||
if ((mathTrace = dynamic_pointer_cast<view::MathTrace>(t))) {
|
||||
mathTrace->set_enable(false);
|
||||
if (mathTrace->get_index() == _ch_combobox->currentData().toInt()) {
|
||||
mathTrace->get_math_stack()->set_dc_ignore(_dc_checkbox->isChecked());
|
||||
|
||||
@@ -54,7 +54,7 @@ Search::Search(QWidget *parent, SigSession &session, std::map<uint16_t, QString>
|
||||
_session.get_signals()) {
|
||||
assert(sig);
|
||||
boost::shared_ptr<view::LogicSignal> logic_sig;
|
||||
if (logic_sig = boost::dynamic_pointer_cast<view::LogicSignal>(sig)) {
|
||||
if ((logic_sig = boost::dynamic_pointer_cast<view::LogicSignal>(sig))) {
|
||||
QLineEdit *search_lineEdit = new QLineEdit(this);
|
||||
if (pattern.find(logic_sig->get_index()) != pattern.end())
|
||||
search_lineEdit->setText(pattern[logic_sig->get_index()]);
|
||||
@@ -115,7 +115,7 @@ std::map<uint16_t, QString> Search::get_pattern()
|
||||
_session.get_signals()) {
|
||||
assert(sig);
|
||||
boost::shared_ptr<view::LogicSignal> logic_sig;
|
||||
if (logic_sig = boost::dynamic_pointer_cast<view::LogicSignal>(sig)) {
|
||||
if ((logic_sig = boost::dynamic_pointer_cast<view::LogicSignal>(sig))) {
|
||||
pattern[logic_sig->get_index()] = _search_lineEdit_vec[index]->text();
|
||||
index++;
|
||||
}
|
||||
|
||||
@@ -356,7 +356,7 @@ void DsoTriggerDock::init()
|
||||
channel_comboBox->clear();
|
||||
BOOST_FOREACH(const boost::shared_ptr<view::Signal> s, _session.get_signals()) {
|
||||
boost::shared_ptr<view::DsoSignal> dsoSig;
|
||||
if (dsoSig = dynamic_pointer_cast<view::DsoSignal>(s)) {
|
||||
if ((dsoSig = dynamic_pointer_cast<view::DsoSignal>(s))) {
|
||||
channel_comboBox->addItem(dsoSig->get_name(), qVariantFromValue(dsoSig->get_index()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -254,6 +254,7 @@ void MeasureDock::cursor_moving()
|
||||
|
||||
void MeasureDock::reCalc()
|
||||
{
|
||||
cursor_update();
|
||||
update_dist();
|
||||
update_edge();
|
||||
}
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
#include "mainframe.h"
|
||||
|
||||
#include "toolbars/titlebar.h"
|
||||
#include "dialogs/dsmessagebox.h"
|
||||
#include "dialogs/dsdialog.h"
|
||||
#include "mainwindow.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
@@ -30,9 +32,14 @@
|
||||
#include <QHoverEvent>
|
||||
#include <QPixmap>
|
||||
#include <QPainter>
|
||||
#include <QLabel>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QBitmap>
|
||||
#include <QResizeEvent>
|
||||
#include <QDesktopWidget>
|
||||
#include <QDesktopServices>
|
||||
#include <QPushButton>
|
||||
#include <QMessageBox>
|
||||
#include <QApplication>
|
||||
|
||||
#include <algorithm>
|
||||
@@ -357,8 +364,8 @@ void MainFrame::readSettings()
|
||||
QSettings settings;
|
||||
QDesktopWidget* desktopWidget = QApplication::desktop();
|
||||
QRect deskRect = desktopWidget->availableGeometry();
|
||||
QPoint default_upleft = QPoint((deskRect.width() - minWidth)/2, (deskRect.height() - minHeight)/2);
|
||||
QSize default_size = QSize(minWidth, minHeight);
|
||||
QPoint default_upleft = QPoint((deskRect.width() - defWidth)/2, (deskRect.height() - defHeight)/2);
|
||||
QSize default_size = QSize(defWidth, defHeight);
|
||||
|
||||
settings.beginGroup("MainFrame");
|
||||
bool isMax = settings.value("isMax", false).toBool();
|
||||
@@ -386,4 +393,47 @@ void MainFrame::readSettings()
|
||||
}
|
||||
}
|
||||
|
||||
void MainFrame::setTaskbarProgress(int progress)
|
||||
{
|
||||
(void)progress;
|
||||
}
|
||||
|
||||
void MainFrame::show_doc()
|
||||
{
|
||||
const QString DOC_KEY("ShowDocuments");
|
||||
QSettings settings;
|
||||
|
||||
if (!settings.contains(DOC_KEY)) {
|
||||
dialogs::DSDialog dlg(this);
|
||||
dlg.setTitle(tr("Document"));
|
||||
|
||||
QLabel tipsLabel;
|
||||
tipsLabel.setPixmap(QPixmap(":/icons/showDoc.png"));
|
||||
QMessageBox msg;
|
||||
msg.setWindowFlags(Qt::Dialog | Qt::FramelessWindowHint | Qt::WindowSystemMenuHint);
|
||||
msg.setContentsMargins(0, 0, 0, 0);
|
||||
connect(&msg, SIGNAL(buttonClicked(QAbstractButton*)), &dlg, SLOT(accept()));
|
||||
QPushButton *noMoreButton = msg.addButton(tr("Not Show Again"), QMessageBox::ActionRole);
|
||||
msg.addButton(tr("Ignore"), QMessageBox::ActionRole);
|
||||
QPushButton *openButton = msg.addButton(tr("Open"), QMessageBox::ActionRole);
|
||||
|
||||
QVBoxLayout layout;
|
||||
layout.addWidget(&tipsLabel);
|
||||
layout.addWidget(&msg, 0, Qt::AlignRight);
|
||||
layout.setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
dlg.layout()->addLayout(&layout);
|
||||
dlg.exec();
|
||||
|
||||
if (msg.clickedButton() == openButton) {
|
||||
QDir dir(DS_RES_PATH);
|
||||
dir.cdUp();
|
||||
QDesktopServices::openUrl(
|
||||
QUrl("file:///"+dir.absolutePath() + "/ug.pdf"));
|
||||
}
|
||||
if (msg.clickedButton() == noMoreButton)
|
||||
settings.setValue(DOC_KEY, false);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace pv
|
||||
|
||||
@@ -38,12 +38,19 @@ namespace toolbars {
|
||||
class TitleBar;
|
||||
}
|
||||
|
||||
namespace dialogs {
|
||||
class DSMessageBox;
|
||||
class DSDialog;
|
||||
}
|
||||
|
||||
class MainFrame : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
static const int minWidth = 800;
|
||||
static const int minHeight = 680;
|
||||
static const int minWidth = 600;
|
||||
static const int minHeight = 500;
|
||||
static const int defWidth = 900;
|
||||
static const int defHeight = 680;
|
||||
|
||||
public:
|
||||
static const int Margin = 5;
|
||||
@@ -77,6 +84,8 @@ public slots:
|
||||
void showNormal();
|
||||
void showMaximized();
|
||||
void showMinimized();
|
||||
void show_doc();
|
||||
void setTaskbarProgress(int progress);
|
||||
|
||||
private:
|
||||
void hide_border();
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
#include <QDockWidget>
|
||||
#include <QDebug>
|
||||
#include <QDesktopWidget>
|
||||
#include <QDesktopServices>
|
||||
#include <QKeyEvent>
|
||||
#include <QEvent>
|
||||
#include <QtGlobal>
|
||||
@@ -176,12 +177,12 @@ void MainWindow::setup_ui()
|
||||
SLOT(run_stop()));
|
||||
connect(_sampling_bar, SIGNAL(instant_stop()), this,
|
||||
SLOT(instant_stop()));
|
||||
connect(_sampling_bar, SIGNAL(sample_count_changed()), _trigger_widget,
|
||||
connect(_sampling_bar, SIGNAL(duration_changed()), _trigger_widget,
|
||||
SLOT(device_updated()));
|
||||
connect(_sampling_bar, SIGNAL(duration_changed()), _view,
|
||||
SLOT(timebase_changed()));
|
||||
connect(_sampling_bar, SIGNAL(show_calibration()), _view,
|
||||
SLOT(show_calibration()));
|
||||
connect(_sampling_bar, SIGNAL(hide_calibration()), _view,
|
||||
SLOT(hide_calibration()));
|
||||
connect(_dso_trigger_widget, SIGNAL(set_trig_pos(int)), _view,
|
||||
SLOT(set_trig_pos(int)));
|
||||
connect(_view, SIGNAL(auto_trig(int)), _dso_trigger_widget,
|
||||
@@ -252,7 +253,11 @@ void MainWindow::setup_ui()
|
||||
SLOT(reCalc()));
|
||||
connect(&_session, SIGNAL(repeat_resume()), this,
|
||||
SLOT(repeat_resume()));
|
||||
connect(&_session, SIGNAL(update_capture()), _view,
|
||||
SLOT(update_hori_res()), Qt::DirectConnection);
|
||||
|
||||
connect(&_session, SIGNAL(cur_samplerate_changed()), _measure_widget,
|
||||
SLOT(cursor_update()));
|
||||
connect(_view, SIGNAL(cursor_update()), _measure_widget,
|
||||
SLOT(cursor_update()));
|
||||
connect(_view, SIGNAL(cursor_moving()), _measure_widget,
|
||||
@@ -307,11 +312,11 @@ void MainWindow::update_device_list()
|
||||
|
||||
shared_ptr<pv::device::DevInst> selected_device = _session.get_device();
|
||||
_device_manager.add_device(selected_device);
|
||||
_sampling_bar->set_device_list(_device_manager.devices(), selected_device);
|
||||
_session.init_signals();
|
||||
_sampling_bar->set_device_list(_device_manager.devices(), selected_device);
|
||||
|
||||
shared_ptr<pv::device::File> file_dev;
|
||||
if(file_dev = dynamic_pointer_cast<pv::device::File>(selected_device)) {
|
||||
if((file_dev = dynamic_pointer_cast<pv::device::File>(selected_device))) {
|
||||
#ifdef ENABLE_DECODE
|
||||
// load decoders
|
||||
StoreSession ss(_session);
|
||||
@@ -457,7 +462,7 @@ void MainWindow::run_stop()
|
||||
_session.start_capture(false,
|
||||
boost::bind(&MainWindow::session_error, this,
|
||||
QString(tr("Capture failed")), _1));
|
||||
_view->capture_init(false);
|
||||
_view->capture_init();
|
||||
break;
|
||||
|
||||
case SigSession::Running:
|
||||
@@ -475,7 +480,7 @@ void MainWindow::instant_stop()
|
||||
_session.start_capture(true,
|
||||
boost::bind(&MainWindow::session_error, this,
|
||||
QString(tr("Capture failed")), _1));
|
||||
_view->capture_init(true);
|
||||
_view->capture_init();
|
||||
break;
|
||||
|
||||
case SigSession::Running:
|
||||
@@ -633,6 +638,10 @@ void MainWindow::on_trigger(bool visible)
|
||||
|
||||
void MainWindow::commit_trigger(bool instant)
|
||||
{
|
||||
int i = 0;
|
||||
const QString TRIG_KEY("WarnofMultiTrig");
|
||||
QSettings settings;
|
||||
|
||||
ds_trigger_init();
|
||||
|
||||
if (_session.get_device()->dev_inst()->mode != LOGIC ||
|
||||
@@ -645,8 +654,37 @@ void MainWindow::commit_trigger(bool instant)
|
||||
{
|
||||
assert(s);
|
||||
boost::shared_ptr<view::LogicSignal> logicSig;
|
||||
if (logicSig = dynamic_pointer_cast<view::LogicSignal>(s))
|
||||
logicSig->commit_trig();
|
||||
if ((logicSig = dynamic_pointer_cast<view::LogicSignal>(s))) {
|
||||
if (logicSig->commit_trig())
|
||||
i++;
|
||||
}
|
||||
}
|
||||
if (!settings.contains(TRIG_KEY) &&
|
||||
i > 1) {
|
||||
dialogs::DSMessageBox msg(this);
|
||||
msg.mBox()->setText(tr("Trigger"));
|
||||
msg.mBox()->setInformativeText(tr("Trigger setted on multiple channels! "
|
||||
"Capture will Only triggered when all setted channels fullfill at one sample"));
|
||||
msg.mBox()->setIcon(QMessageBox::Information);
|
||||
|
||||
QPushButton *noMoreButton = msg.mBox()->addButton(tr("Not Show Again"), QMessageBox::ActionRole);
|
||||
QPushButton *cancelButton = msg.mBox()->addButton(tr("Clear Trig"), QMessageBox::ActionRole);
|
||||
msg.mBox()->addButton(tr("Continue"), QMessageBox::ActionRole);
|
||||
|
||||
msg.exec();
|
||||
if (msg.mBox()->clickedButton() == cancelButton) {
|
||||
BOOST_FOREACH(const boost::shared_ptr<view::Signal> s, _session.get_signals())
|
||||
{
|
||||
assert(s);
|
||||
boost::shared_ptr<view::LogicSignal> logicSig;
|
||||
if ((logicSig = dynamic_pointer_cast<view::LogicSignal>(s))) {
|
||||
logicSig->set_trig(view::LogicSignal::NONTRIG);
|
||||
logicSig->commit_trig();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (msg.mBox()->clickedButton() == noMoreButton)
|
||||
settings.setValue(TRIG_KEY, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -783,8 +821,6 @@ bool MainWindow::load_session(QString name)
|
||||
if (!isEnabled)
|
||||
probe->enabled = false;
|
||||
}
|
||||
_sampling_bar->update_sample_rate_selector();
|
||||
_trigger_widget->device_updated();
|
||||
|
||||
//_session.init_signals();
|
||||
_session.reload();
|
||||
@@ -799,12 +835,12 @@ bool MainWindow::load_session(QString name)
|
||||
s->set_name(g_strdup(obj["name"].toString().toStdString().c_str()));
|
||||
|
||||
boost::shared_ptr<view::LogicSignal> logicSig;
|
||||
if (logicSig = dynamic_pointer_cast<view::LogicSignal>(s)) {
|
||||
if ((logicSig = dynamic_pointer_cast<view::LogicSignal>(s))) {
|
||||
logicSig->set_trig(obj["strigger"].toDouble());
|
||||
}
|
||||
|
||||
boost::shared_ptr<view::DsoSignal> dsoSig;
|
||||
if (dsoSig = dynamic_pointer_cast<view::DsoSignal>(s)) {
|
||||
if ((dsoSig = dynamic_pointer_cast<view::DsoSignal>(s))) {
|
||||
dsoSig->load_settings();
|
||||
dsoSig->set_zero_vrate(obj["zeroPos"].toDouble(), true);
|
||||
dsoSig->set_trig_vrate(obj["trigValue"].toDouble());
|
||||
@@ -812,7 +848,7 @@ bool MainWindow::load_session(QString name)
|
||||
}
|
||||
|
||||
boost::shared_ptr<view::AnalogSignal> analogSig;
|
||||
if (analogSig = dynamic_pointer_cast<view::AnalogSignal>(s)) {
|
||||
if ((analogSig = dynamic_pointer_cast<view::AnalogSignal>(s))) {
|
||||
analogSig->set_zero_vrate(obj["zeroPos"].toDouble(), true);
|
||||
analogSig->commit_settings();
|
||||
}
|
||||
@@ -822,6 +858,10 @@ bool MainWindow::load_session(QString name)
|
||||
}
|
||||
}
|
||||
|
||||
// update UI settings
|
||||
_sampling_bar->update_sample_rate_selector();
|
||||
_trigger_widget->device_updated();
|
||||
|
||||
// load trigger settings
|
||||
if (sessionObj.contains("trigger")) {
|
||||
_trigger_widget->set_session(sessionObj["trigger"].toObject());
|
||||
@@ -898,12 +938,12 @@ bool MainWindow::store_session(QString name)
|
||||
s_obj["colour"] = QJsonValue::fromVariant(s->get_colour());
|
||||
|
||||
boost::shared_ptr<view::LogicSignal> logicSig;
|
||||
if (logicSig = dynamic_pointer_cast<view::LogicSignal>(s)) {
|
||||
if ((logicSig = dynamic_pointer_cast<view::LogicSignal>(s))) {
|
||||
s_obj["strigger"] = logicSig->get_trig();
|
||||
}
|
||||
|
||||
boost::shared_ptr<view::DsoSignal> dsoSig;
|
||||
if (dsoSig = dynamic_pointer_cast<view::DsoSignal>(s)) {
|
||||
if ((dsoSig = dynamic_pointer_cast<view::DsoSignal>(s))) {
|
||||
s_obj["vdiv"] = QJsonValue::fromVariant(static_cast<qulonglong>(dsoSig->get_vDialValue()));
|
||||
s_obj["vfactor"] = QJsonValue::fromVariant(static_cast<qulonglong>(dsoSig->get_factor()));
|
||||
s_obj["coupling"] = dsoSig->get_acCoupling();
|
||||
@@ -912,7 +952,7 @@ bool MainWindow::store_session(QString name)
|
||||
}
|
||||
|
||||
boost::shared_ptr<view::AnalogSignal> analogSig;
|
||||
if (analogSig = dynamic_pointer_cast<view::AnalogSignal>(s)) {
|
||||
if ((analogSig = dynamic_pointer_cast<view::AnalogSignal>(s))) {
|
||||
s_obj["vdiv"] = QJsonValue::fromVariant(static_cast<qulonglong>(analogSig->get_vdiv()));
|
||||
s_obj["coupling"] = analogSig->get_acCoupling();
|
||||
s_obj["zeroPos"] = analogSig->get_zero_vrate();
|
||||
@@ -992,7 +1032,7 @@ bool MainWindow::eventFilter(QObject *object, QEvent *event)
|
||||
case Qt::Key_0:
|
||||
BOOST_FOREACH(const shared_ptr<view::Signal> s, sigs) {
|
||||
shared_ptr<view::DsoSignal> dsoSig;
|
||||
if (dsoSig = dynamic_pointer_cast<view::DsoSignal>(s)) {
|
||||
if ((dsoSig = dynamic_pointer_cast<view::DsoSignal>(s))) {
|
||||
if (dsoSig->get_index() == 0)
|
||||
dsoSig->set_vDialActive(!dsoSig->get_vDialActive());
|
||||
else
|
||||
@@ -1005,7 +1045,7 @@ bool MainWindow::eventFilter(QObject *object, QEvent *event)
|
||||
case Qt::Key_1:
|
||||
BOOST_FOREACH(const shared_ptr<view::Signal> s, sigs) {
|
||||
shared_ptr<view::DsoSignal> dsoSig;
|
||||
if (dsoSig = dynamic_pointer_cast<view::DsoSignal>(s)) {
|
||||
if ((dsoSig = dynamic_pointer_cast<view::DsoSignal>(s))) {
|
||||
if (dsoSig->get_index() == 1)
|
||||
dsoSig->set_vDialActive(!dsoSig->get_vDialActive());
|
||||
else
|
||||
@@ -1018,7 +1058,7 @@ bool MainWindow::eventFilter(QObject *object, QEvent *event)
|
||||
case Qt::Key_Up:
|
||||
BOOST_FOREACH(const shared_ptr<view::Signal> s, sigs) {
|
||||
shared_ptr<view::DsoSignal> dsoSig;
|
||||
if (dsoSig = dynamic_pointer_cast<view::DsoSignal>(s)) {
|
||||
if ((dsoSig = dynamic_pointer_cast<view::DsoSignal>(s))) {
|
||||
if (dsoSig->get_vDialActive()) {
|
||||
dsoSig->go_vDialNext();
|
||||
update();
|
||||
@@ -1030,7 +1070,7 @@ bool MainWindow::eventFilter(QObject *object, QEvent *event)
|
||||
case Qt::Key_Down:
|
||||
BOOST_FOREACH(const shared_ptr<view::Signal> s, sigs) {
|
||||
shared_ptr<view::DsoSignal> dsoSig;
|
||||
if (dsoSig = dynamic_pointer_cast<view::DsoSignal>(s)) {
|
||||
if ((dsoSig = dynamic_pointer_cast<view::DsoSignal>(s))) {
|
||||
if (dsoSig->get_vDialActive()) {
|
||||
dsoSig->go_vDialPre();
|
||||
update();
|
||||
|
||||
@@ -47,7 +47,7 @@ DeviceOptions::DeviceOptions(struct sr_dev_inst *sdi) :
|
||||
GVariant *gvar_opts, *gvar_list;
|
||||
gsize num_opts;
|
||||
|
||||
if ((sr_config_list(sdi->driver, sdi, NULL, SR_CONF_DEVICE_CONFIGS,
|
||||
if ((sr_config_list(sdi->driver, sdi, NULL, SR_CONF_DEVICE_OPTIONS,
|
||||
&gvar_opts) != SR_OK))
|
||||
/* Driver supports no device instance options. */
|
||||
return;
|
||||
@@ -109,7 +109,6 @@ 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;
|
||||
|
||||
|
||||
@@ -215,11 +215,11 @@ QString ProbeOptions::print_gvariant(GVariant *const gvar)
|
||||
|
||||
QString ProbeOptions::print_vdiv(GVariant *const gvar)
|
||||
{
|
||||
uint64_t p, q;
|
||||
uint64_t p, q;
|
||||
g_variant_get(gvar, "t", &p);
|
||||
if (p < 1000ULL) {
|
||||
q = 1000;
|
||||
} else if (p < 1000000ULL) {
|
||||
} else {
|
||||
q = 1;
|
||||
p /= 1000;
|
||||
}
|
||||
|
||||
@@ -172,11 +172,10 @@ void SigSession::set_device(boost::shared_ptr<device::DevInst> dev_inst) throw(Q
|
||||
_cur_samplerate = _dev_inst->get_sample_rate();
|
||||
_cur_samplelimits = _dev_inst->get_sample_limit();
|
||||
|
||||
// if (_dev_inst->dev_inst()->mode == DSO)
|
||||
// set_run_mode(Repetitive);
|
||||
// else
|
||||
// set_run_mode(Single);
|
||||
set_run_mode(Single);
|
||||
if (_dev_inst->dev_inst()->mode == DSO)
|
||||
set_run_mode(Repetitive);
|
||||
else
|
||||
set_run_mode(Single);
|
||||
} catch(const QString e) {
|
||||
throw(e);
|
||||
return;
|
||||
@@ -289,6 +288,8 @@ void SigSession::set_cur_samplerate(uint64_t samplerate)
|
||||
// MathStack
|
||||
BOOST_FOREACH(const boost::shared_ptr<view::MathTrace> m, _math_traces)
|
||||
m->get_math_stack()->set_samplerate(_cur_samplerate);
|
||||
|
||||
cur_samplerate_changed();
|
||||
}
|
||||
|
||||
void SigSession::set_cur_samplelimits(uint64_t samplelimits)
|
||||
@@ -302,8 +303,12 @@ void SigSession::capture_init()
|
||||
{
|
||||
if (!_instant)
|
||||
set_repeating(get_run_mode() == Repetitive);
|
||||
_cur_samplerate = _dev_inst->get_sample_rate();
|
||||
_cur_samplelimits = _dev_inst->get_sample_limit();
|
||||
// update instant setting
|
||||
_dev_inst->set_config(NULL, NULL, SR_CONF_INSTANT, g_variant_new_boolean(_instant));
|
||||
update_capture();
|
||||
|
||||
set_cur_samplerate(_dev_inst->get_sample_rate());
|
||||
set_cur_samplelimits(_dev_inst->get_sample_limit());
|
||||
_data_updated = false;
|
||||
_trigger_flag = false;
|
||||
_hw_replied = false;
|
||||
@@ -314,62 +319,58 @@ void SigSession::capture_init()
|
||||
_noData_cnt = 0;
|
||||
data_unlock();
|
||||
|
||||
// Init and Set sample rate for all SignalData
|
||||
// Analog/Dso
|
||||
if (_analog_data) {
|
||||
_analog_data->init();
|
||||
_analog_data->set_samplerate(_cur_samplerate);
|
||||
}
|
||||
if (_dso_data) {
|
||||
_dso_data->init();
|
||||
_dso_data->set_samplerate(_cur_samplerate);
|
||||
}
|
||||
|
||||
// MathStack
|
||||
BOOST_FOREACH(const boost::shared_ptr<view::MathTrace> m, _math_traces)
|
||||
{
|
||||
assert(m);
|
||||
m->get_math_stack()->init();
|
||||
m->get_math_stack()->set_samplerate(_cur_samplerate);
|
||||
}
|
||||
// container init
|
||||
container_init();
|
||||
|
||||
// update current hw offset
|
||||
BOOST_FOREACH(const boost::shared_ptr<view::Signal> s, _signals)
|
||||
{
|
||||
assert(s);
|
||||
boost::shared_ptr<view::DsoSignal> dsoSig;
|
||||
if (dsoSig = dynamic_pointer_cast<view::DsoSignal>(s)) {
|
||||
if ((dsoSig = dynamic_pointer_cast<view::DsoSignal>(s))) {
|
||||
dsoSig->set_zero_vrate(dsoSig->get_zero_vrate(), true);
|
||||
}
|
||||
boost::shared_ptr<view::AnalogSignal> analogSig;
|
||||
if (analogSig = dynamic_pointer_cast<view::AnalogSignal>(s)) {
|
||||
if ((analogSig = dynamic_pointer_cast<view::AnalogSignal>(s))) {
|
||||
analogSig->set_zero_vrate(analogSig->get_zero_vrate(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SigSession::logic_init()
|
||||
void SigSession::container_init()
|
||||
{
|
||||
// Logic
|
||||
if (_logic_data) {
|
||||
if (_logic_data)
|
||||
_logic_data->init();
|
||||
_logic_data->set_samplerate(_cur_samplerate);
|
||||
}
|
||||
|
||||
// Group
|
||||
if (_group_data) {
|
||||
if (_group_data)
|
||||
_group_data->init();
|
||||
_group_data->set_samplerate(_cur_samplerate);
|
||||
|
||||
// Dso
|
||||
if (_analog_data)
|
||||
_analog_data->init();
|
||||
|
||||
// Analog
|
||||
if (_dso_data)
|
||||
_dso_data->init();
|
||||
|
||||
// MathStack
|
||||
BOOST_FOREACH(const boost::shared_ptr<view::MathTrace> m, _math_traces)
|
||||
{
|
||||
assert(m);
|
||||
m->get_math_stack()->init();
|
||||
}
|
||||
|
||||
#ifdef ENABLE_DECODE
|
||||
// DecoderModel
|
||||
pv::data::DecoderModel *decoder_model = get_decoder_model();
|
||||
decoder_model->setDecoderStack(NULL);
|
||||
//pv::data::DecoderModel *decoder_model = get_decoder_model();
|
||||
//decoder_model->setDecoderStack(NULL);
|
||||
// DecoderStack
|
||||
BOOST_FOREACH(const boost::shared_ptr<view::DecodeTrace> d, _decode_traces)
|
||||
{
|
||||
assert(d);
|
||||
d->decoder()->init();
|
||||
d->decoder()->set_samplerate(_cur_samplerate);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -426,7 +427,7 @@ void SigSession::start_capture(bool instant,
|
||||
|
||||
void SigSession::stop_capture()
|
||||
{
|
||||
_instant = false;
|
||||
data_unlock();
|
||||
#ifdef ENABLE_DECODE
|
||||
for (vector< boost::shared_ptr<view::DecodeTrace> >::iterator i =
|
||||
_decode_traces.begin();
|
||||
@@ -533,6 +534,7 @@ void SigSession::sample_thread_proc(boost::shared_ptr<device::DevInst> dev_inst,
|
||||
|
||||
void SigSession::check_update()
|
||||
{
|
||||
data_unlock();
|
||||
if (_capture_state != Running)
|
||||
return;
|
||||
|
||||
@@ -540,6 +542,7 @@ void SigSession::check_update()
|
||||
data_updated();
|
||||
_data_updated = false;
|
||||
_noData_cnt = 0;
|
||||
data_auto_unlock();
|
||||
} else {
|
||||
if (++_noData_cnt >= (WaitShowTime/ViewTime))
|
||||
nodata_timeout();
|
||||
@@ -737,7 +740,7 @@ void SigSession::reload()
|
||||
while (i != _signals.end()) {
|
||||
if ((*i)->get_index() == probe->index) {
|
||||
boost::shared_ptr<view::LogicSignal> logicSig;
|
||||
if (logicSig = dynamic_pointer_cast<view::LogicSignal>(*i))
|
||||
if ((logicSig = dynamic_pointer_cast<view::LogicSignal>(*i)))
|
||||
signal = boost::shared_ptr<view::Signal>(
|
||||
new view::LogicSignal(logicSig, _logic_data, probe));
|
||||
break;
|
||||
@@ -761,7 +764,7 @@ void SigSession::reload()
|
||||
while (i != _signals.end()) {
|
||||
if ((*i)->get_index() == probe->index) {
|
||||
boost::shared_ptr<view::AnalogSignal> analogSig;
|
||||
if (analogSig = dynamic_pointer_cast<view::AnalogSignal>(*i))
|
||||
if ((analogSig = dynamic_pointer_cast<view::AnalogSignal>(*i)))
|
||||
signal = boost::shared_ptr<view::Signal>(
|
||||
new view::AnalogSignal(analogSig, _analog_data, probe));
|
||||
break;
|
||||
@@ -792,7 +795,7 @@ void SigSession::refresh(int holdtime)
|
||||
{
|
||||
boost::lock_guard<boost::mutex> lock(_data_mutex);
|
||||
|
||||
_data_lock = true;
|
||||
data_lock();
|
||||
QTimer::singleShot(holdtime, this, SLOT(data_unlock()));
|
||||
|
||||
if (_logic_data) {
|
||||
@@ -823,6 +826,11 @@ void SigSession::refresh(int holdtime)
|
||||
_data_updated = true;
|
||||
}
|
||||
|
||||
void SigSession::data_lock()
|
||||
{
|
||||
_data_lock = true;
|
||||
}
|
||||
|
||||
void SigSession::data_unlock()
|
||||
{
|
||||
_data_lock = false;
|
||||
@@ -833,6 +841,21 @@ bool SigSession::get_data_lock()
|
||||
return _data_lock;
|
||||
}
|
||||
|
||||
void SigSession::data_auto_lock(int lock) {
|
||||
_data_auto_lock = lock;
|
||||
}
|
||||
|
||||
void SigSession::data_auto_unlock() {
|
||||
if (_data_auto_lock > 0)
|
||||
_data_auto_lock--;
|
||||
else if (_data_auto_lock < 0)
|
||||
_data_auto_lock = 0;
|
||||
}
|
||||
|
||||
bool SigSession::get_data_auto_lock() {
|
||||
return _data_auto_lock != 0;
|
||||
}
|
||||
|
||||
void SigSession::feed_in_header(const sr_dev_inst *sdi)
|
||||
{
|
||||
(void)sdi;
|
||||
@@ -920,7 +943,6 @@ void SigSession::feed_in_logic(const sr_datafeed_logic &logic)
|
||||
}
|
||||
|
||||
if (_cur_logic_snapshot->last_ended()) {
|
||||
logic_init();
|
||||
_cur_logic_snapshot->first_payload(logic, _dev_inst->get_sample_limit(), _dev_inst->dev_inst()->channels);
|
||||
// @todo Putting this here means that only listeners querying
|
||||
// for logic will be notified. Currently the only user of
|
||||
@@ -962,7 +984,7 @@ void SigSession::feed_in_dso(const sr_datafeed_dso &dso)
|
||||
{
|
||||
assert(s);
|
||||
boost::shared_ptr<view::DsoSignal> dsoSig;
|
||||
if (dsoSig = dynamic_pointer_cast<view::DsoSignal>(s)) {
|
||||
if ((dsoSig = dynamic_pointer_cast<view::DsoSignal>(s))) {
|
||||
dsoSig->set_scale(dsoSig->get_view_rect().height());
|
||||
sig_enable[dsoSig->get_index()] = dsoSig->enabled();
|
||||
}
|
||||
@@ -991,6 +1013,8 @@ void SigSession::feed_in_dso(const sr_datafeed_dso &dso)
|
||||
_trigger_flag = dso.trig_flag;
|
||||
receive_data(dso.num_samples);
|
||||
//data_updated();
|
||||
if (!_instant)
|
||||
data_lock();
|
||||
_data_updated = true;
|
||||
}
|
||||
|
||||
@@ -1032,7 +1056,7 @@ void SigSession::data_feed_in(const struct sr_dev_inst *sdi,
|
||||
|
||||
boost::lock_guard<boost::mutex> lock(_data_mutex);
|
||||
|
||||
if (_data_lock)
|
||||
if (_data_lock && packet->type != SR_DF_END)
|
||||
return;
|
||||
if (packet->type != SR_DF_END &&
|
||||
packet->status != SR_PKT_OK) {
|
||||
@@ -1095,10 +1119,7 @@ void SigSession::data_feed_in(const struct sr_dev_inst *sdi,
|
||||
_cur_group_snapshot.reset();
|
||||
}
|
||||
}
|
||||
if (!_cur_logic_snapshot->last_ended())
|
||||
_cur_logic_snapshot->capture_ended();
|
||||
else if (get_run_mode() != SigSession::Repetitive)
|
||||
logic_init();
|
||||
_cur_logic_snapshot->capture_ended();
|
||||
_cur_dso_snapshot->capture_ended();
|
||||
_cur_analog_snapshot->capture_ended();
|
||||
#ifdef ENABLE_DECODE
|
||||
@@ -1405,7 +1426,7 @@ void SigSession::mathTraces_rebuild()
|
||||
bool has_dso_signal = false;
|
||||
BOOST_FOREACH(const boost::shared_ptr<view::Signal> s, _signals) {
|
||||
boost::shared_ptr<view::DsoSignal> dsoSig;
|
||||
if (dsoSig = dynamic_pointer_cast<view::DsoSignal>(s)) {
|
||||
if ((dsoSig = dynamic_pointer_cast<view::DsoSignal>(s))) {
|
||||
has_dso_signal = true;
|
||||
// check already have
|
||||
std::vector< boost::shared_ptr<view::MathTrace> >::iterator iter = _math_traces.begin();
|
||||
|
||||
@@ -96,7 +96,7 @@ private:
|
||||
static const int RepeatHoldDiv = 20;
|
||||
|
||||
public:
|
||||
static const int ViewTime = 100;
|
||||
static const int ViewTime = 50;
|
||||
static const int WaitShowTime = 500;
|
||||
|
||||
public:
|
||||
@@ -155,7 +155,7 @@ public:
|
||||
boost::function<void (const QString)> error_handler);
|
||||
void capture_init();
|
||||
bool get_capture_status(bool &triggered, int &progress);
|
||||
void logic_init();
|
||||
void container_init();
|
||||
|
||||
std::set< boost::shared_ptr<data::SignalData> > get_data() const;
|
||||
|
||||
@@ -201,6 +201,9 @@ public:
|
||||
bool get_instant();
|
||||
|
||||
bool get_data_lock();
|
||||
void data_auto_lock(int lock);
|
||||
void data_auto_unlock();
|
||||
bool get_data_auto_lock();
|
||||
void mathTraces_rebuild();
|
||||
|
||||
bool trigd() const;
|
||||
@@ -307,6 +310,7 @@ private:
|
||||
int _noData_cnt;
|
||||
bool _data_lock;
|
||||
bool _data_updated;
|
||||
int _data_auto_lock;
|
||||
|
||||
QDateTime _trigger_time;
|
||||
uint64_t _trigger_pos;
|
||||
@@ -365,6 +369,10 @@ signals:
|
||||
void repeat_hold(int percent);
|
||||
void repeat_resume();
|
||||
|
||||
void cur_samplerate_changed();
|
||||
|
||||
void update_capture();
|
||||
|
||||
public slots:
|
||||
void reload();
|
||||
void refresh(int holdtime);
|
||||
@@ -374,6 +382,7 @@ public slots:
|
||||
void set_map_zoom(int index);
|
||||
|
||||
private slots:
|
||||
void data_lock();
|
||||
void data_unlock();
|
||||
void check_update();
|
||||
void nodata_timeout();
|
||||
|
||||
@@ -190,7 +190,7 @@ void StoreSession::save_proc(shared_ptr<data::Snapshot> snapshot)
|
||||
shared_ptr<data::AnalogSnapshot> analog_snapshot;
|
||||
shared_ptr<data::DsoSnapshot> dso_snapshot;
|
||||
|
||||
if (logic_snapshot = boost::dynamic_pointer_cast<data::LogicSnapshot>(snapshot)) {
|
||||
if ((logic_snapshot = boost::dynamic_pointer_cast<data::LogicSnapshot>(snapshot))) {
|
||||
uint16_t to_save_probes = 0;
|
||||
BOOST_FOREACH(const boost::shared_ptr<view::Signal> s, _session.get_signals()) {
|
||||
if (s->enabled() && logic_snapshot->has_data(s->get_index()))
|
||||
@@ -330,7 +330,7 @@ QString StoreSession::meta_gen(boost::shared_ptr<data::Snapshot> snapshot)
|
||||
}
|
||||
|
||||
shared_ptr<data::LogicSnapshot> logic_snapshot;
|
||||
if (logic_snapshot = dynamic_pointer_cast<data::LogicSnapshot>(snapshot)) {
|
||||
if ((logic_snapshot = dynamic_pointer_cast<data::LogicSnapshot>(snapshot))) {
|
||||
uint16_t to_save_probes = 0;
|
||||
for (l = sdi->channels; l; l = l->next) {
|
||||
probe = (struct sr_channel *)l->data;
|
||||
@@ -361,7 +361,7 @@ QString StoreSession::meta_gen(boost::shared_ptr<data::Snapshot> snapshot)
|
||||
fprintf(meta, "trigger time = %lld\n", _session.get_trigger_time().toMSecsSinceEpoch());
|
||||
} else if (sdi->mode == ANALOG) {
|
||||
shared_ptr<data::AnalogSnapshot> analog_snapshot;
|
||||
if (analog_snapshot = dynamic_pointer_cast<data::AnalogSnapshot>(snapshot)) {
|
||||
if ((analog_snapshot = dynamic_pointer_cast<data::AnalogSnapshot>(snapshot))) {
|
||||
uint8_t tmp_u8 = analog_snapshot->get_unit_bytes();
|
||||
fprintf(meta, "bits = %d\n", tmp_u8*8);
|
||||
}
|
||||
@@ -373,7 +373,7 @@ QString StoreSession::meta_gen(boost::shared_ptr<data::Snapshot> snapshot)
|
||||
probe = (struct sr_channel *)l->data;
|
||||
if (snapshot->has_data(probe->index)) {
|
||||
if (probe->name)
|
||||
fprintf(meta, "probe%d = %s\n", probecnt, probe->name);
|
||||
fprintf(meta, "probe%d = %s\n", (sdi->mode == LOGIC) ? probe->index : probecnt, probe->name);
|
||||
if (probe->trigger)
|
||||
fprintf(meta, " trigger%d = %s\n", probecnt, probe->trigger);
|
||||
if (sdi->mode == DSO) {
|
||||
@@ -493,11 +493,11 @@ void StoreSession::export_proc(shared_ptr<data::Snapshot> snapshot)
|
||||
shared_ptr<data::DsoSnapshot> dso_snapshot;
|
||||
int channel_type;
|
||||
|
||||
if (logic_snapshot = boost::dynamic_pointer_cast<data::LogicSnapshot>(snapshot)) {
|
||||
if ((logic_snapshot = boost::dynamic_pointer_cast<data::LogicSnapshot>(snapshot))) {
|
||||
channel_type = SR_CHANNEL_LOGIC;
|
||||
} else if (dso_snapshot = boost::dynamic_pointer_cast<data::DsoSnapshot>(snapshot)) {
|
||||
} else if ((dso_snapshot = boost::dynamic_pointer_cast<data::DsoSnapshot>(snapshot))) {
|
||||
channel_type = SR_CHANNEL_DSO;
|
||||
} else if (analog_snapshot = boost::dynamic_pointer_cast<data::AnalogSnapshot>(snapshot)) {
|
||||
} else if ((analog_snapshot = boost::dynamic_pointer_cast<data::AnalogSnapshot>(snapshot))) {
|
||||
channel_type = SR_CHANNEL_ANALOG;
|
||||
} else {
|
||||
_has_error = true;
|
||||
|
||||
@@ -118,7 +118,7 @@ void LogoBar::on_actionAbout_triggered()
|
||||
void LogoBar::on_actionManual_triggered()
|
||||
{
|
||||
QDir dir(DS_RES_PATH);
|
||||
dir.cdUp();
|
||||
dir.cdUp();
|
||||
QDesktopServices::openUrl(
|
||||
QUrl("file:///"+dir.absolutePath() + "/ug.pdf"));
|
||||
}
|
||||
|
||||
@@ -260,7 +260,7 @@ void SamplingBar::zero_adj()
|
||||
boost::shared_ptr<view::DsoSignal> dsoSig;
|
||||
BOOST_FOREACH(const boost::shared_ptr<view::Signal> s, _session.get_signals())
|
||||
{
|
||||
if (dsoSig = dynamic_pointer_cast<view::DsoSignal>(s))
|
||||
if ((dsoSig = dynamic_pointer_cast<view::DsoSignal>(s)))
|
||||
dsoSig->set_enable(true);
|
||||
}
|
||||
run_stop();
|
||||
@@ -269,7 +269,7 @@ void SamplingBar::zero_adj()
|
||||
if (wait.start() ==QDialog::Rejected) {
|
||||
BOOST_FOREACH(const boost::shared_ptr<view::Signal> s, _session.get_signals())
|
||||
{
|
||||
if (dsoSig = dynamic_pointer_cast<view::DsoSignal>(s))
|
||||
if ((dsoSig = dynamic_pointer_cast<view::DsoSignal>(s)))
|
||||
dsoSig->commit_settings();
|
||||
}
|
||||
}
|
||||
@@ -427,6 +427,7 @@ void SamplingBar::update_sample_count_selector()
|
||||
uint64_t hw_depth = 0;
|
||||
uint64_t sw_depth;
|
||||
uint64_t rle_depth = 0;
|
||||
uint64_t max_timebase = 0;
|
||||
double pre_duration = SR_SEC(1);
|
||||
double duration;
|
||||
bool rle_support = false;
|
||||
@@ -474,6 +475,12 @@ void SamplingBar::update_sample_count_selector()
|
||||
}
|
||||
if (rle_support)
|
||||
rle_depth = min(hw_depth*SR_KB(1), sw_depth);
|
||||
} else if (dev_inst->dev_inst()->mode == DSO) {
|
||||
gvar = dev_inst->get_config(NULL, NULL, SR_CONF_MAX_TIMEBASE);
|
||||
if (gvar != NULL) {
|
||||
max_timebase = g_variant_get_uint64(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
}
|
||||
|
||||
if (0 != _sample_count.count())
|
||||
@@ -484,7 +491,7 @@ void SamplingBar::update_sample_count_selector()
|
||||
_sample_rate.currentIndex()).value<uint64_t>();
|
||||
const double hw_duration = hw_depth / (samplerate * (1.0 / SR_SEC(1)));
|
||||
if (dev_inst->dev_inst()->mode == DSO)
|
||||
duration = SR_SEC(10);
|
||||
duration = max_timebase;
|
||||
else if (stream_mode)
|
||||
duration = sw_depth / (samplerate * (1.0 / SR_SEC(1)));
|
||||
else if (rle_support)
|
||||
@@ -492,10 +499,11 @@ void SamplingBar::update_sample_count_selector()
|
||||
else
|
||||
duration = hw_duration;
|
||||
|
||||
assert(duration > 0);
|
||||
bool not_last = true;
|
||||
do {
|
||||
QString suffix = (dev_inst->dev_inst()->mode == DSO) ? DIVString :
|
||||
(!stream_mode & duration > hw_duration) ? RLEString : "";
|
||||
(!stream_mode && duration > hw_duration) ? RLEString : "";
|
||||
char *const s = sr_time_string(duration);
|
||||
_sample_count.addItem(QString(s) + suffix,
|
||||
qVariantFromValue(duration));
|
||||
@@ -526,6 +534,9 @@ void SamplingBar::update_sample_count_selector()
|
||||
|
||||
if (dev_inst->dev_inst()->mode == DSO)
|
||||
not_last = duration >= SR_NS(10);
|
||||
else if (dev_inst->dev_inst()->mode == ANALOG)
|
||||
not_last = (duration >= SR_MS(100)) &&
|
||||
(duration / SR_SEC(1) * samplerate >= SR_KB(1));
|
||||
else
|
||||
not_last = (duration / SR_SEC(1) * samplerate >= SR_KB(1));
|
||||
} while(not_last);
|
||||
@@ -542,11 +553,11 @@ void SamplingBar::update_sample_count_selector()
|
||||
_sample_count.setCurrentIndex(i);
|
||||
break;
|
||||
}
|
||||
sample_count_changed();
|
||||
}
|
||||
_updating_sample_count = false;
|
||||
|
||||
update_sample_count_selector_value();
|
||||
on_samplecount_sel(_sample_count.currentIndex());
|
||||
connect(&_sample_count, SIGNAL(currentIndexChanged(int)),
|
||||
this, SLOT(on_samplecount_sel(int)));
|
||||
}
|
||||
@@ -604,8 +615,7 @@ void SamplingBar::on_samplecount_sel(int index)
|
||||
const shared_ptr<device::DevInst> dev_inst = get_selected_device();
|
||||
if (dev_inst->dev_inst()->mode == DSO)
|
||||
commit_hori_res();
|
||||
else
|
||||
sample_count_changed();
|
||||
duration_changed();
|
||||
}
|
||||
|
||||
double SamplingBar::get_hori_res()
|
||||
@@ -616,6 +626,9 @@ double SamplingBar::get_hori_res()
|
||||
double SamplingBar::hori_knob(int dir)
|
||||
{
|
||||
double hori_res = -1;
|
||||
disconnect(&_sample_count, SIGNAL(currentIndexChanged(int)),
|
||||
this, SLOT(on_samplecount_sel(int)));
|
||||
|
||||
if (0 == dir) {
|
||||
hori_res = commit_hori_res();
|
||||
} else if ((dir > 0) && (_sample_count.currentIndex() > 0)) {
|
||||
@@ -625,6 +638,10 @@ double SamplingBar::hori_knob(int dir)
|
||||
_sample_count.setCurrentIndex(_sample_count.currentIndex() + 1);
|
||||
hori_res = commit_hori_res();
|
||||
}
|
||||
|
||||
connect(&_sample_count, SIGNAL(currentIndexChanged(int)),
|
||||
this, SLOT(on_samplecount_sel(int)));
|
||||
|
||||
return hori_res;
|
||||
}
|
||||
|
||||
@@ -649,7 +666,7 @@ double SamplingBar::commit_hori_res()
|
||||
const uint64_t sample_rate = min((uint64_t)(sample_limit * SR_SEC(1) /
|
||||
(hori_res * DS_CONF_DSO_HDIVS)),
|
||||
(uint64_t)(max_sample_rate /
|
||||
(_session.get_ch_num(DSO) ? _session.get_ch_num(DSO) : 1)));
|
||||
(_session.get_ch_num(SR_CHANNEL_DSO) ? _session.get_ch_num(SR_CHANNEL_DSO) : 1)));
|
||||
set_sample_rate(sample_rate);
|
||||
if (_session.get_capture_state() != SigSession::Stopped)
|
||||
_session.set_cur_samplerate(dev_inst->get_sample_rate());
|
||||
|
||||
@@ -100,7 +100,7 @@ signals:
|
||||
void instant_stop();
|
||||
void device_selected();
|
||||
void device_updated();
|
||||
void sample_count_changed();
|
||||
void duration_changed();
|
||||
void show_calibration();
|
||||
void hide_calibration();
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ void TitleBar::paintEvent(QPaintEvent *)
|
||||
p.setBrush(QColor(48, 47, 47, 255));
|
||||
p.drawRect(rect());
|
||||
|
||||
const int xgap = 2.5;
|
||||
const int xgap = 2;
|
||||
const int xstart = 10;
|
||||
p.setPen(QPen(QColor(213, 15, 37, 255), 2, Qt::SolidLine));
|
||||
p.drawLine(xstart + xgap*0, height()*0.50, xstart + xgap*0, height()*0.66);
|
||||
|
||||
@@ -112,6 +112,10 @@ int AnalogSignal::commit_settings()
|
||||
{
|
||||
int ret;
|
||||
|
||||
// -- enable
|
||||
ret = _dev_inst->set_config(_probe, NULL, SR_CONF_PROBE_EN,
|
||||
g_variant_new_boolean(enabled()));
|
||||
|
||||
// -- vdiv
|
||||
ret = _dev_inst->set_config(_probe, NULL, SR_CONF_PROBE_VDIV,
|
||||
g_variant_new_uint64(_probe->vdiv));
|
||||
@@ -169,7 +173,7 @@ QString AnalogSignal::get_mapUnit() const
|
||||
|
||||
double AnalogSignal::get_mapMin() const
|
||||
{
|
||||
double min;
|
||||
double min = -1;
|
||||
GVariant* gvar = _dev_inst->get_config(_probe, NULL, SR_CONF_PROBE_MAP_MIN);
|
||||
if (gvar != NULL) {
|
||||
min = g_variant_get_double(gvar);
|
||||
@@ -180,7 +184,7 @@ double AnalogSignal::get_mapMin() const
|
||||
|
||||
double AnalogSignal::get_mapMax() const
|
||||
{
|
||||
double max;
|
||||
double max = 1;
|
||||
GVariant* gvar = _dev_inst->get_config(_probe, NULL, SR_CONF_PROBE_MAP_MAX);
|
||||
if (gvar != NULL) {
|
||||
max = g_variant_get_double(gvar);
|
||||
@@ -196,14 +200,14 @@ void AnalogSignal::set_zero_vpos(int pos)
|
||||
{
|
||||
if (enabled()) {
|
||||
const int height = get_totalHeight();
|
||||
const int bottom = get_y() + height / 2;
|
||||
set_zero_vrate(min(max(bottom - pos, 0), height) * 1.0 / height, false);
|
||||
const int top = get_y() - height / 2;
|
||||
set_zero_vrate(min(max(pos - top, 0), height) * 1.0 / height, false);
|
||||
}
|
||||
}
|
||||
|
||||
int AnalogSignal::get_zero_vpos() const
|
||||
{
|
||||
return (0.5 - _zero_vrate) * get_totalHeight() + get_y();
|
||||
return (_zero_vrate - 0.5) * get_totalHeight() + get_y();
|
||||
}
|
||||
|
||||
void AnalogSignal::set_zero_vrate(double rate, bool force_update)
|
||||
@@ -271,7 +275,7 @@ void AnalogSignal::paint_back(QPainter &p, int left, int right)
|
||||
|
||||
// paint rule
|
||||
double y = get_y() - height * 0.5;
|
||||
double mapValue = get_mapMax() + (0.5 - _zero_vrate) * (get_mapMax() - get_mapMin());
|
||||
double mapValue = get_mapMax() + (_zero_vrate - 0.5) * (get_mapMax() - get_mapMin());
|
||||
for (i = 0; i < DIVS; i++) {
|
||||
p.drawLine(left, y, left+10, y);
|
||||
if (i == 0 || i == DIVS/2)
|
||||
@@ -310,7 +314,7 @@ void AnalogSignal::paint_mid(QPainter &p, int left, int right)
|
||||
const int height = get_totalHeight();
|
||||
const int top = get_y() - height * 0.5;
|
||||
const int bottom = get_y() + height * 0.5;
|
||||
const float zeroY = bottom - _zero_vrate * height ;
|
||||
const float zeroY = _zero_vrate * height + top;
|
||||
|
||||
const double scale = _view->scale();
|
||||
assert(scale > 0);
|
||||
@@ -461,10 +465,10 @@ void AnalogSignal::paint_envelope(QPainter &p,
|
||||
_rects = new QRectF[width+3];
|
||||
QRectF *rect = _rects;
|
||||
int px = -1, pre_px;
|
||||
int y_min, y_max, pre_y_min, pre_y_max;
|
||||
int y_min = zeroY, y_max = zeroY, pre_y_min = zeroY, pre_y_max = zeroY;
|
||||
int pcnt = 0;
|
||||
const double scale_samples_pre_pixel = samples_per_pixel / e.scale;
|
||||
const uint64_t ring_end = snapshot->get_ring_end() / e.scale;
|
||||
const uint64_t ring_end = max((int64_t)0, (int64_t)snapshot->get_ring_end() / e.scale - 1);
|
||||
// const int64_t start_offset = start_pixel -
|
||||
// (int64_t)(e.start / scale_samples_pre_pixel + 0.5);
|
||||
// for(uint64_t sample = 0; sample < e.length; sample++) {
|
||||
|
||||
@@ -60,7 +60,7 @@ void DevMode::set_device()
|
||||
|
||||
assert(dev_inst);
|
||||
|
||||
for(std::map<QPushButton *, sr_dev_mode *>::const_iterator i = _mode_button_list.begin();
|
||||
for(std::map<QPushButton *, const sr_dev_mode *>::const_iterator i = _mode_button_list.begin();
|
||||
i != _mode_button_list.end(); i++) {
|
||||
(*i).first->setParent(NULL);
|
||||
_layout->removeWidget((*i).first);
|
||||
@@ -68,9 +68,9 @@ void DevMode::set_device()
|
||||
}
|
||||
_mode_button_list.clear();
|
||||
|
||||
for (GSList *l = dev_inst->get_dev_mode_list();
|
||||
for (const GSList *l = dev_inst->get_dev_mode_list();
|
||||
l; l = l->next) {
|
||||
sr_dev_mode *mode = (sr_dev_mode *)l->data;
|
||||
const sr_dev_mode *mode = (const sr_dev_mode *)l->data;
|
||||
|
||||
QPushButton *mode_button = new QPushButton(this);
|
||||
//mode_button->setFlat(true);
|
||||
@@ -111,7 +111,7 @@ void DevMode::on_mode_change()
|
||||
if (dev_inst->dev_inst()->mode == _mode_button_list[button]->mode)
|
||||
return;
|
||||
|
||||
for(std::map<QPushButton *, sr_dev_mode *>::const_iterator i = _mode_button_list.begin();
|
||||
for(std::map<QPushButton *, const sr_dev_mode *>::const_iterator i = _mode_button_list.begin();
|
||||
i != _mode_button_list.end(); i++) {
|
||||
if ((*i).first == button) {
|
||||
if (dev_inst->dev_inst()->mode != (*i).second->mode) {
|
||||
|
||||
@@ -80,7 +80,7 @@ private:
|
||||
SigSession &_session;
|
||||
|
||||
QGridLayout * _layout;
|
||||
std::map <QPushButton *, sr_dev_mode *> _mode_button_list;
|
||||
std::map <QPushButton *, const sr_dev_mode *> _mode_button_list;
|
||||
QPoint _mouse_point;
|
||||
};
|
||||
|
||||
|
||||
@@ -41,16 +41,6 @@ using namespace std;
|
||||
namespace pv {
|
||||
namespace view {
|
||||
|
||||
const uint64_t DsoSignal::vDialValue[DsoSignal::vDialValueCount] = {
|
||||
10,
|
||||
20,
|
||||
50,
|
||||
100,
|
||||
200,
|
||||
500,
|
||||
1000,
|
||||
2000,
|
||||
};
|
||||
const QString DsoSignal::vDialUnit[DsoSignal::vDialUnitCount] = {
|
||||
"mv",
|
||||
"v",
|
||||
@@ -72,6 +62,7 @@ DsoSignal::DsoSignal(boost::shared_ptr<pv::device::DevInst> dev_inst,
|
||||
Signal(dev_inst, probe),
|
||||
_data(data),
|
||||
_scale(0),
|
||||
_en_lock(false),
|
||||
_vDialActive(false),
|
||||
_autoV(false),
|
||||
_autoH(false),
|
||||
@@ -84,13 +75,26 @@ DsoSignal::DsoSignal(boost::shared_ptr<pv::device::DevInst> dev_inst,
|
||||
{
|
||||
QVector<uint64_t> vValue;
|
||||
QVector<QString> vUnit;
|
||||
for(uint64_t i = 0; i < vDialValueCount; i++)
|
||||
vValue.append(vDialValue[i]);
|
||||
for(uint64_t i = 0; i < vDialUnitCount; i++)
|
||||
vUnit.append(vDialUnit[i]);
|
||||
|
||||
_vDial = new dslDial(vDialValueCount, vDialValueStep, vValue, vUnit);
|
||||
|
||||
GVariant *gvar_list, *gvar_list_vdivs;
|
||||
if (sr_config_list(dev_inst->dev_inst()->driver, dev_inst->dev_inst(),
|
||||
NULL, SR_CONF_PROBE_VDIV, &gvar_list) == SR_OK) {
|
||||
assert(gvar_list);
|
||||
if ((gvar_list_vdivs = g_variant_lookup_value(gvar_list,
|
||||
"vdivs", G_VARIANT_TYPE("at")))) {
|
||||
GVariant *gvar;
|
||||
GVariantIter iter;
|
||||
g_variant_iter_init(&iter, gvar_list_vdivs);
|
||||
while(NULL != (gvar = g_variant_iter_next_value(&iter)))
|
||||
vValue.push_back(g_variant_get_uint64(gvar));
|
||||
g_variant_unref(gvar);
|
||||
g_variant_unref(gvar_list_vdivs);
|
||||
g_variant_unref(gvar_list);
|
||||
}
|
||||
}
|
||||
_vDial = new dslDial(vValue.count(), vDialValueStep, vValue, vUnit);
|
||||
_colour = SignalColours[probe->index % countof(SignalColours)];
|
||||
|
||||
load_settings();
|
||||
@@ -144,6 +148,7 @@ void DsoSignal::set_enable(bool enable)
|
||||
get_index() == 0)
|
||||
return;
|
||||
|
||||
_en_lock = true;
|
||||
GVariant* gvar;
|
||||
bool cur_enable;
|
||||
gvar = _dev_inst->get_config(_probe, NULL, SR_CONF_PROBE_EN);
|
||||
@@ -151,11 +156,14 @@ void DsoSignal::set_enable(bool enable)
|
||||
cur_enable = g_variant_get_boolean(gvar);
|
||||
g_variant_unref(gvar);
|
||||
} else {
|
||||
qDebug() << "ERROR: config_get SR_CONF_MAX_DSO_SAMPLERATE failed.";
|
||||
qDebug() << "ERROR: config_get SR_CONF_PROBE_EN failed.";
|
||||
_en_lock = false;
|
||||
return;
|
||||
}
|
||||
if (cur_enable == enable)
|
||||
if (cur_enable == enable) {
|
||||
_en_lock = false;
|
||||
return;
|
||||
}
|
||||
|
||||
bool running = false;
|
||||
if (_view->session().get_capture_state() == SigSession::Running) {
|
||||
@@ -169,14 +177,14 @@ void DsoSignal::set_enable(bool enable)
|
||||
_dev_inst->set_config(_probe, NULL, SR_CONF_PROBE_EN,
|
||||
g_variant_new_boolean(enable));
|
||||
|
||||
_view->update_hori_res();
|
||||
if (running) {
|
||||
//_view->session().refresh(RefreshShort);
|
||||
_view->update_hori_res();
|
||||
_view->session().repeat_resume();
|
||||
}
|
||||
|
||||
_view->set_update(_viewport, true);
|
||||
_view->update();
|
||||
_en_lock = false;
|
||||
}
|
||||
|
||||
bool DsoSignal::get_vDialActive() const
|
||||
@@ -203,11 +211,12 @@ bool DsoSignal::go_vDialPre()
|
||||
_scale *= pre_vdiv/_vDial->get_value();
|
||||
update_vpos();
|
||||
_view->update_calibration();
|
||||
//_view->set_update(_viewport, true);
|
||||
//_view->update();
|
||||
_view->set_update(_viewport, true);
|
||||
_view->update();
|
||||
return true;
|
||||
} else {
|
||||
autoV_end();
|
||||
if (_autoV)
|
||||
autoV_end();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -225,11 +234,12 @@ bool DsoSignal::go_vDialNext()
|
||||
_scale *= pre_vdiv/_vDial->get_value();
|
||||
update_vpos();
|
||||
_view->update_calibration();
|
||||
//_view->set_update(_viewport, true);
|
||||
//_view->update();
|
||||
_view->set_update(_viewport, true);
|
||||
_view->update();
|
||||
return true;
|
||||
} else {
|
||||
autoV_end();
|
||||
if (_autoV)
|
||||
autoV_end();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -598,8 +608,8 @@ void DsoSignal::paint_back(QPainter &p, int left, int right)
|
||||
|
||||
p.setPen(Trace::dsLightBlue);
|
||||
p.drawLine(left, UpMargin/2, left + width, UpMargin/2);
|
||||
const uint64_t sample_len = _dev_inst->get_sample_limit();
|
||||
const double samplerate = _dev_inst->get_sample_rate();
|
||||
const uint64_t sample_len = _view->session().cur_samplelimits();
|
||||
const double samplerate = _view->session().cur_samplerate();
|
||||
const double samples_per_pixel = samplerate * _view->scale();
|
||||
const double shown_rate = min(samples_per_pixel * width * 1.0 / sample_len, 1.0);
|
||||
const double start = _view->offset() * samples_per_pixel;
|
||||
@@ -917,11 +927,13 @@ void DsoSignal::paint_type_options(QPainter &p, int right, const QPoint pt)
|
||||
p.drawText(acdc_rect, Qt::AlignCenter | Qt::AlignVCenter, (_acCoupling == SR_GND_COUPLING) ? tr("GND") :
|
||||
(_acCoupling == SR_DC_COUPLING) ? tr("DC") : tr("AC"));
|
||||
|
||||
p.setPen(Qt::transparent);
|
||||
p.setBrush(enabled() ? (auto_rect.contains(pt) ? _colour.darker() : _colour) : dsDisable);
|
||||
p.drawRect(auto_rect);
|
||||
p.setPen(Qt::white);
|
||||
p.drawText(auto_rect, Qt::AlignCenter | Qt::AlignVCenter, tr("AUTO"));
|
||||
if (!_dev_inst->name().contains("virtual")) {
|
||||
p.setPen(Qt::transparent);
|
||||
p.setBrush(enabled() ? (auto_rect.contains(pt) ? _colour.darker() : _colour) : dsDisable);
|
||||
p.drawRect(auto_rect);
|
||||
p.setPen(Qt::white);
|
||||
p.drawText(auto_rect, Qt::AlignCenter | Qt::AlignVCenter, tr("AUTO"));
|
||||
}
|
||||
|
||||
// paint the probe factor selector
|
||||
GVariant* gvar;
|
||||
@@ -962,8 +974,9 @@ bool DsoSignal::mouse_press(int right, const QPoint pt)
|
||||
|
||||
if (chEn_rect.contains(pt)) {
|
||||
if (_dev_inst->name() != "virtual-session" &&
|
||||
!_view->session().get_data_lock())
|
||||
!_en_lock) {
|
||||
set_enable(!enabled());
|
||||
}
|
||||
return true;
|
||||
} else if (enabled()) {
|
||||
if (vDial_rect.contains(pt) && pt.x() > vDial_rect.center().x()) {
|
||||
@@ -978,7 +991,8 @@ bool DsoSignal::mouse_press(int right, const QPoint pt)
|
||||
else
|
||||
set_acCoupling((get_acCoupling()+1)%2);
|
||||
} else if (auto_rect.contains(pt)) {
|
||||
auto_start();
|
||||
if (!_dev_inst->name().contains("virtual"))
|
||||
auto_start();
|
||||
} else if (x1_rect.contains(pt)) {
|
||||
set_factor(1);
|
||||
} else if (x10_rect.contains(pt)) {
|
||||
@@ -1068,7 +1082,7 @@ void DsoSignal::paint_measure(QPainter &p)
|
||||
double value_max = (_hw_offset - _min) * _scale * _vDial->get_value() * _vDial->get_factor() * DS_CONF_DSO_VDIVS / get_view_rect().height();
|
||||
double value_min = (_hw_offset - _max) * _scale * _vDial->get_value() * _vDial->get_factor() * DS_CONF_DSO_VDIVS / get_view_rect().height();
|
||||
double value_p2p = value_max - value_min;
|
||||
_period = (count == 0) ? period * 10.0 : period * 10.0 / count;
|
||||
_period = (count == 0) ? 0 : period * 10.0 / count;
|
||||
const int channel_count = _view->session().get_ch_num(SR_CHANNEL_DSO);
|
||||
uint64_t sample_rate = _dev_inst->get_sample_rate();
|
||||
_period = _period * 200.0 / (channel_count * sample_rate * 1.0 / SR_MHZ(1));
|
||||
@@ -1161,7 +1175,7 @@ void DsoSignal::paint_measure(QPainter &p)
|
||||
autoH_end();
|
||||
}
|
||||
|
||||
if (_autoV && !_view->session().get_data_lock()) {
|
||||
if (_autoV && !_view->session().get_data_auto_lock()) {
|
||||
set_zero_vrate(0.5, true);
|
||||
const uint8_t vscale = abs(_max - _min);
|
||||
if (_max == 0xff || _min == 0x00 || vscale > 0xCC) {
|
||||
@@ -1171,17 +1185,21 @@ void DsoSignal::paint_measure(QPainter &p)
|
||||
} else {
|
||||
go_vDialPre();
|
||||
}
|
||||
_view->session().data_auto_lock(AutoLock);
|
||||
}
|
||||
|
||||
if (_autoH && !_view->session().get_data_lock()) {
|
||||
if (_autoH && !_view->session().get_data_auto_lock()) {
|
||||
const double hori_res = _view->get_hori_res();
|
||||
if (_period < 1.5*hori_res) {
|
||||
if (_period <= 0) {
|
||||
_view->zoom(-1);
|
||||
} else if (_period < 1.5*hori_res) {
|
||||
_view->zoom(1);
|
||||
} else if (_period > 6*hori_res) {
|
||||
_view->zoom(-1);
|
||||
} else {
|
||||
autoH_end();
|
||||
}
|
||||
_view->session().data_auto_lock(AutoLock);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1215,6 +1233,7 @@ void DsoSignal::auto_start()
|
||||
if (_autoV || _autoH)
|
||||
return;
|
||||
if (_view->session().get_capture_state() == SigSession::Running) {
|
||||
_view->session().data_auto_lock(AutoLock);
|
||||
_autoV = true;
|
||||
_autoH = true;
|
||||
QTimer::singleShot(AutoTime, this, SLOT(auto_end()));
|
||||
@@ -1261,7 +1280,7 @@ bool DsoSignal::measure(const QPointF &p)
|
||||
const double scale = _view->scale();
|
||||
assert(scale > 0);
|
||||
const int64_t pixels_offset = _view->offset();
|
||||
const double samplerate = _dev_inst->get_sample_rate();
|
||||
const double samplerate = _view->session().cur_samplerate();
|
||||
const double samples_per_pixel = samplerate * scale;
|
||||
|
||||
_hover_index = floor((p.x() + pixels_offset) * samples_per_pixel+0.5);
|
||||
|
||||
@@ -47,10 +47,8 @@ private:
|
||||
static const float EnvelopeThreshold;
|
||||
|
||||
static const int HitCursorMargin = 3;
|
||||
static const uint64_t vDialValueCount = 8;
|
||||
static const uint64_t vDialValueStep = 1000;
|
||||
static const uint64_t vDialUnitCount = 2;
|
||||
static const uint64_t vDialValue[vDialValueCount];
|
||||
static const QString vDialUnit[vDialUnitCount];
|
||||
|
||||
static const int UpMargin = 30;
|
||||
@@ -62,6 +60,7 @@ private:
|
||||
static const int RefreshShort = 200;
|
||||
static const int RefreshLong = 800;
|
||||
static const int AutoTime = 10000;
|
||||
static const int AutoLock = 3;
|
||||
|
||||
public:
|
||||
enum DsoSetRegions {
|
||||
@@ -213,6 +212,7 @@ private:
|
||||
private:
|
||||
boost::shared_ptr<pv::data::Dso> _data;
|
||||
float _scale;
|
||||
bool _en_lock;
|
||||
|
||||
dslDial *_vDial;
|
||||
bool _vDialActive;
|
||||
|
||||
@@ -298,14 +298,14 @@ void Header::mouseMoveEvent(QMouseEvent *event)
|
||||
int y = (*i).second + delta;
|
||||
if (sig->get_type() == SR_CHANNEL_DSO) {
|
||||
boost::shared_ptr<DsoSignal> dsoSig;
|
||||
if (dsoSig = dynamic_pointer_cast<DsoSignal>(sig)) {
|
||||
if ((dsoSig = dynamic_pointer_cast<DsoSignal>(sig))) {
|
||||
dsoSig->set_zero_vpos(y);
|
||||
_moveFlag = true;
|
||||
traces_moved();
|
||||
}
|
||||
} else if (sig->get_type() == SR_CHANNEL_ANALOG) {
|
||||
boost::shared_ptr<AnalogSignal> analogSig;
|
||||
if (analogSig = dynamic_pointer_cast<AnalogSignal>(sig)) {
|
||||
if ((analogSig = dynamic_pointer_cast<AnalogSignal>(sig))) {
|
||||
analogSig->set_zero_vpos(y);
|
||||
_moveFlag = true;
|
||||
traces_moved();
|
||||
|
||||
@@ -106,12 +106,13 @@ void LogicSignal::set_trig(int trig)
|
||||
_trig = NONTRIG;
|
||||
}
|
||||
|
||||
void LogicSignal::commit_trig()
|
||||
bool LogicSignal::commit_trig()
|
||||
{
|
||||
|
||||
if (_trig == NONTRIG)
|
||||
if (_trig == NONTRIG) {
|
||||
ds_trigger_probe_set(_index_list.front(), 'X', 'X');
|
||||
else {
|
||||
return false;
|
||||
} else {
|
||||
ds_trigger_set_en(true);
|
||||
if (_trig == POSTRIG)
|
||||
ds_trigger_probe_set(_index_list.front(), 'R', 'X');
|
||||
@@ -123,6 +124,7 @@ void LogicSignal::commit_trig()
|
||||
ds_trigger_probe_set(_index_list.front(), '0', 'X');
|
||||
else if (_trig == EDGTRIG)
|
||||
ds_trigger_probe_set(_index_list.front(), 'C', 'X');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -55,6 +55,7 @@ private:
|
||||
|
||||
static const int TogMaxScale = 10;
|
||||
|
||||
public:
|
||||
enum LogicSetRegions{
|
||||
NONTRIG = 0,
|
||||
POSTRIG,
|
||||
@@ -86,7 +87,7 @@ public:
|
||||
*/
|
||||
LogicSetRegions get_trig() const;
|
||||
void set_trig(int trig);
|
||||
void commit_trig();
|
||||
bool commit_trig();
|
||||
|
||||
/**
|
||||
* Paints the signal with a QPainter
|
||||
|
||||
@@ -292,7 +292,7 @@ void MathTrace::paint_mid(QPainter &p, int left, int right)
|
||||
double vfactor = 0;
|
||||
BOOST_FOREACH(const boost::shared_ptr<Signal> s, _session.get_signals()) {
|
||||
boost::shared_ptr<DsoSignal> dsoSig;
|
||||
if (dsoSig = dynamic_pointer_cast<DsoSignal>(s)) {
|
||||
if ((dsoSig = dynamic_pointer_cast<DsoSignal>(s))) {
|
||||
if(dsoSig->get_index() == _math_stack->get_index()) {
|
||||
vdiv = dsoSig->get_vDialValue();
|
||||
vfactor = dsoSig->get_factor();
|
||||
@@ -358,8 +358,8 @@ void MathTrace::paint_fore(QPainter &p, int left, int right)
|
||||
double blank_right = width;
|
||||
|
||||
// horizontal ruler
|
||||
const double NyFreq = _session.get_device()->get_sample_rate() / (2.0 * _math_stack->get_sample_interval());
|
||||
const double deltaFreq = _session.get_device()->get_sample_rate() * 1.0 /
|
||||
const double NyFreq = _session.cur_samplerate() / (2.0 * _math_stack->get_sample_interval());
|
||||
const double deltaFreq = _session.cur_samplerate() * 1.0 /
|
||||
(_math_stack->get_sample_num() * _math_stack->get_sample_interval());
|
||||
const double FreqRange = NyFreq * _scale;
|
||||
const double FreqOffset = NyFreq * _offset;
|
||||
|
||||
@@ -220,19 +220,16 @@ double View::get_maxscale() const
|
||||
return _maxscale;
|
||||
}
|
||||
|
||||
void View::capture_init(bool instant)
|
||||
void View::capture_init()
|
||||
{
|
||||
_maxscale = _session.cur_sampletime() / (get_view_width() * MaxViewRate);
|
||||
|
||||
if (_session.get_device()->dev_inst()->mode == DSO)
|
||||
show_trig_cursor(true);
|
||||
else if (!_session.isRepeating())
|
||||
show_trig_cursor(false);
|
||||
|
||||
_maxscale = _session.cur_sampletime() / (get_view_width() * MaxViewRate);
|
||||
if (_session.get_device()->dev_inst()->mode == ANALOG)
|
||||
set_scale_offset(_maxscale, 0);
|
||||
|
||||
_session.get_device()->set_config(NULL, NULL, SR_CONF_INSTANT, g_variant_new_boolean(instant));
|
||||
update_hori_res();
|
||||
status_clear();
|
||||
}
|
||||
|
||||
@@ -259,12 +256,9 @@ double View::get_hori_res()
|
||||
|
||||
void View::update_hori_res()
|
||||
{
|
||||
if (_session.get_device()->dev_inst()->mode == DSO)
|
||||
if (_session.get_device()->dev_inst()->mode == DSO) {
|
||||
_sampling_bar->hori_knob(0);
|
||||
|
||||
const uint64_t final_limit = _session.get_device()->get_sample_limit();
|
||||
_trig_cursor->set_index(_trig_cursor->index() * 1.0 / _session.cur_samplelimits() * final_limit);
|
||||
_session.set_cur_samplelimits(final_limit);
|
||||
}
|
||||
}
|
||||
|
||||
void View::zoom(double steps, int offset)
|
||||
@@ -274,8 +268,7 @@ void View::zoom(double steps, int offset)
|
||||
_preOffset = _offset;
|
||||
|
||||
if (_session.get_device()->dev_inst()->mode != DSO) {
|
||||
//_scale *= std::pow(3.0/2.0, -steps);
|
||||
_scale *= std::pow(2, -steps);
|
||||
_scale *= std::pow(3.0/2.0, -steps);
|
||||
_scale = max(min(_scale, _maxscale), _minscale);
|
||||
} else {
|
||||
if (_session.get_capture_state() == SigSession::Running &&
|
||||
@@ -306,6 +299,18 @@ void View::zoom(double steps, int offset)
|
||||
//}
|
||||
}
|
||||
|
||||
void View::timebase_changed()
|
||||
{
|
||||
if (_session.get_device()->dev_inst()->mode != DSO)
|
||||
return;
|
||||
|
||||
double scale = this->scale();
|
||||
double hori_res = _sampling_bar->get_hori_res();
|
||||
if (hori_res > 0)
|
||||
scale = hori_res * DS_CONF_DSO_HDIVS / SR_SEC(1) / get_view_width();
|
||||
set_scale_offset(scale, this->offset());
|
||||
}
|
||||
|
||||
void View::set_scale_offset(double scale, int64_t offset)
|
||||
{
|
||||
//if (_session.get_capture_state() == SigSession::Stopped) {
|
||||
@@ -417,6 +422,8 @@ void View::show_search_cursor(bool show)
|
||||
|
||||
void View::status_clear()
|
||||
{
|
||||
_time_viewport->clear_dso_xm();
|
||||
_time_viewport->clear_measure();
|
||||
_viewbottom->clear();
|
||||
}
|
||||
|
||||
@@ -694,7 +701,7 @@ void View::signals_changed()
|
||||
next_v_offset += traceHeight + 2 * SignalMargin;
|
||||
|
||||
boost::shared_ptr<view::DsoSignal> dsoSig;
|
||||
if (dsoSig = dynamic_pointer_cast<view::DsoSignal>(t)) {
|
||||
if ((dsoSig = dynamic_pointer_cast<view::DsoSignal>(t))) {
|
||||
dsoSig->set_scale(dsoSig->get_view_rect().height());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ public:
|
||||
int64_t get_min_offset();
|
||||
int64_t get_max_offset();
|
||||
|
||||
void capture_init(bool instant);
|
||||
void capture_init();
|
||||
|
||||
void zoom(double steps);
|
||||
void zoom(double steps, int offset);
|
||||
@@ -183,7 +183,6 @@ public:
|
||||
int get_view_width();
|
||||
int get_view_height();
|
||||
|
||||
void update_hori_res();
|
||||
double get_hori_res();
|
||||
|
||||
QString get_measure(QString option);
|
||||
@@ -244,6 +243,10 @@ public slots:
|
||||
void repeat_unshow();
|
||||
// -- repeat
|
||||
void repeat_show();
|
||||
// --
|
||||
void timebase_changed();
|
||||
// --
|
||||
void update_hori_res();
|
||||
|
||||
private slots:
|
||||
|
||||
|
||||
@@ -90,6 +90,9 @@ Viewport::Viewport(View &parent, View_type type) :
|
||||
_drag_strength = 0;
|
||||
_drag_timer.setSingleShot(true);
|
||||
|
||||
_pixmap = new QPixmap(size());
|
||||
_pixmap->fill(Qt::transparent);
|
||||
|
||||
connect(&trigger_timer, SIGNAL(timeout()),
|
||||
this, SLOT(on_trigger_timer()));
|
||||
connect(&_drag_timer, SIGNAL(timeout()),
|
||||
@@ -183,8 +186,8 @@ void Viewport::paintEvent(QPaintEvent *event)
|
||||
|
||||
void Viewport::paintSignals(QPainter &p)
|
||||
{
|
||||
if (_view.session().get_data_lock())
|
||||
return;
|
||||
// if (_view.session().get_data_lock())
|
||||
// return;
|
||||
const vector< boost::shared_ptr<Trace> > traces(_view.get_traces(_type));
|
||||
if (_view.scale() != _curScale ||
|
||||
_view.offset() != _curOffset ||
|
||||
@@ -194,20 +197,24 @@ void Viewport::paintSignals(QPainter &p)
|
||||
_curOffset = _view.offset();
|
||||
_curSignalHeight = _view.get_signalHeight();
|
||||
|
||||
pixmap = QPixmap(size());
|
||||
pixmap.fill(Qt::transparent);
|
||||
QPainter dbp(&pixmap);
|
||||
dbp.initFrom(this);
|
||||
//p.setRenderHint(QPainter::Antialiasing, false);
|
||||
BOOST_FOREACH(const boost::shared_ptr<Trace> t, traces)
|
||||
{
|
||||
assert(t);
|
||||
if (t->enabled())
|
||||
t->paint_mid(dbp, 0, t->get_view_rect().width());
|
||||
//pixmap = QPixmap(size());
|
||||
//pixmap.fill(Qt::transparent);
|
||||
if (_pixmap->size() == size()) {
|
||||
_pixmap->fill(Qt::transparent);
|
||||
QPainter dbp(_pixmap);
|
||||
dbp.initFrom(this);
|
||||
//p.setRenderHint(QPainter::Antialiasing, false);
|
||||
BOOST_FOREACH(const boost::shared_ptr<Trace> t, traces)
|
||||
{
|
||||
assert(t);
|
||||
if (t->enabled())
|
||||
t->paint_mid(dbp, 0, t->get_view_rect().right());
|
||||
}
|
||||
_need_update = false;
|
||||
}
|
||||
_need_update = false;
|
||||
}
|
||||
p.drawPixmap(0, 0, pixmap);
|
||||
if (_pixmap->size() == size())
|
||||
p.drawPixmap(0, 0, *_pixmap);
|
||||
|
||||
// plot cursors
|
||||
const double samples_per_pixel = _view.session().cur_samplerate() * _view.scale();
|
||||
@@ -422,7 +429,7 @@ void Viewport::mousePressEvent(QMouseEvent *event)
|
||||
if (!s->enabled())
|
||||
continue;
|
||||
boost::shared_ptr<DsoSignal> dsoSig;
|
||||
if (dsoSig = dynamic_pointer_cast<DsoSignal>(s)) {
|
||||
if ((dsoSig = dynamic_pointer_cast<DsoSignal>(s))) {
|
||||
if (dsoSig->get_ms_show_hover()) {
|
||||
dsoSig->set_ms_show(!dsoSig->get_ms_show());
|
||||
break;
|
||||
@@ -459,7 +466,7 @@ void Viewport::mousePressEvent(QMouseEvent *event)
|
||||
if (!s->enabled())
|
||||
continue;
|
||||
boost::shared_ptr<DsoSignal> dsoSig;
|
||||
if (dsoSig = dynamic_pointer_cast<DsoSignal>(s)) {
|
||||
if ((dsoSig = dynamic_pointer_cast<DsoSignal>(s))) {
|
||||
if (dsoSig->get_trig_rect(0, _view.get_view_width()).contains(_mouse_point)) {
|
||||
_drag_sig = s;
|
||||
_action_type = DSO_TRIG_MOVE;
|
||||
@@ -530,7 +537,7 @@ void Viewport::mouseMoveEvent(QMouseEvent *event)
|
||||
if (_action_type == DSO_TRIG_MOVE) {
|
||||
if (_drag_sig) {
|
||||
boost::shared_ptr<view::DsoSignal> dsoSig;
|
||||
if (dsoSig = dynamic_pointer_cast<view::DsoSignal>(_drag_sig)) {
|
||||
if ((dsoSig = dynamic_pointer_cast<view::DsoSignal>(_drag_sig))) {
|
||||
dsoSig->set_trig_vpos(event->pos().y(), true);
|
||||
_dso_trig_moved = true;
|
||||
}
|
||||
@@ -593,12 +600,7 @@ void Viewport::mouseMoveEvent(QMouseEvent *event)
|
||||
BOOST_FOREACH(const boost::shared_ptr<Signal> s, _view.session().get_signals()) {
|
||||
assert(s);
|
||||
if (!s->get_view_rect().contains(event->pos())) {
|
||||
_dso_xm_valid = false;
|
||||
_mm_width = "#####";
|
||||
_mm_period = "#####";
|
||||
_mm_freq = "#####";
|
||||
_mm_duty = "#####";
|
||||
_action_type = NO_ACTION;
|
||||
clear_dso_xm();
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -723,12 +725,7 @@ void Viewport::mouseReleaseEvent(QMouseEvent *event)
|
||||
|
||||
_action_type = DSO_XM_STEP2;
|
||||
} else if (event->button() == Qt::RightButton) {
|
||||
_action_type = NO_ACTION;
|
||||
_dso_xm_valid = false;
|
||||
_mm_width = "#####";
|
||||
_mm_period = "#####";
|
||||
_mm_freq = "#####";
|
||||
_mm_duty = "#####";
|
||||
clear_dso_xm();
|
||||
measure_updated();
|
||||
}
|
||||
} else if (_action_type == DSO_XM_STEP2) {
|
||||
@@ -744,12 +741,7 @@ void Viewport::mouseReleaseEvent(QMouseEvent *event)
|
||||
|
||||
_action_type = NO_ACTION;
|
||||
} else if (event->button() == Qt::RightButton) {
|
||||
_action_type = NO_ACTION;
|
||||
_dso_xm_valid = false;
|
||||
_mm_width = "#####";
|
||||
_mm_period = "#####";
|
||||
_mm_freq = "#####";
|
||||
_mm_duty = "#####";
|
||||
clear_dso_xm();
|
||||
measure_updated();
|
||||
}
|
||||
} else if (_action_type == CURS_MOVE) {
|
||||
@@ -854,12 +846,7 @@ void Viewport::mouseDoubleClickEvent(QMouseEvent *event)
|
||||
_view.session().get_capture_state() != SigSession::Init &&
|
||||
event->button() == Qt::LeftButton) {
|
||||
if (_dso_xm_valid) {
|
||||
_dso_xm_valid = false;
|
||||
_action_type = NO_ACTION;
|
||||
_mm_width = "#####";
|
||||
_mm_period = "#####";
|
||||
_mm_freq = "#####";
|
||||
_mm_duty = "#####";
|
||||
clear_dso_xm();
|
||||
measure_updated();
|
||||
} else if (_action_type == NO_ACTION) {
|
||||
BOOST_FOREACH(const boost::shared_ptr<Signal> s, _view.session().get_signals()) {
|
||||
@@ -906,7 +893,7 @@ void Viewport::wheelEvent(QWheelEvent *event)
|
||||
BOOST_FOREACH(const boost::shared_ptr<Signal> s, sigs) {
|
||||
assert(s);
|
||||
boost::shared_ptr<view::DsoSignal> dsoSig;
|
||||
if (dsoSig = dynamic_pointer_cast<view::DsoSignal>(s)) {
|
||||
if ((dsoSig = dynamic_pointer_cast<view::DsoSignal>(s))) {
|
||||
dsoSig->auto_end();
|
||||
}
|
||||
}
|
||||
@@ -932,19 +919,20 @@ void Viewport::leaveEvent(QEvent *)
|
||||
_drag_timer.stop();
|
||||
_action_type = NO_ACTION;
|
||||
} else if (_action_type == DSO_XM_STEP1 || _action_type == DSO_XM_STEP2) {
|
||||
_dso_xm_valid = false;
|
||||
_mm_width = "#####";
|
||||
_mm_period = "#####";
|
||||
_mm_freq = "#####";
|
||||
_mm_duty = "#####";
|
||||
_action_type = NO_ACTION;
|
||||
clear_dso_xm();
|
||||
} else if (_action_type == DSO_YM) {
|
||||
_dso_ym_valid = false;
|
||||
_action_type = NO_ACTION;
|
||||
}
|
||||
|
||||
measure();
|
||||
update();
|
||||
clear_measure();
|
||||
}
|
||||
|
||||
void Viewport::resizeEvent(QResizeEvent*)
|
||||
{
|
||||
if (_pixmap)
|
||||
delete _pixmap;
|
||||
_pixmap = new QPixmap(size());
|
||||
}
|
||||
|
||||
void Viewport::set_receive_len(quint64 length)
|
||||
@@ -968,6 +956,16 @@ void Viewport::clear_measure()
|
||||
update();
|
||||
}
|
||||
|
||||
void Viewport::clear_dso_xm()
|
||||
{
|
||||
_dso_xm_valid = false;
|
||||
_mm_width = "#####";
|
||||
_mm_period = "#####";
|
||||
_mm_freq = "#####";
|
||||
_mm_duty = "#####";
|
||||
_action_type = NO_ACTION;
|
||||
}
|
||||
|
||||
void Viewport::measure()
|
||||
{
|
||||
if (_view.session().get_data_lock())
|
||||
@@ -980,7 +978,7 @@ void Viewport::measure()
|
||||
assert(s);
|
||||
boost::shared_ptr<view::LogicSignal> logicSig;
|
||||
boost::shared_ptr<view::DsoSignal> dsoSig;
|
||||
if (logicSig = dynamic_pointer_cast<view::LogicSignal>(s)) {
|
||||
if ((logicSig = dynamic_pointer_cast<view::LogicSignal>(s))) {
|
||||
if (_action_type == NO_ACTION) {
|
||||
if (logicSig->measure(_mouse_point, _cur_sample, _nxt_sample, _thd_sample)) {
|
||||
_measure_type = LOGIC_FREQ;
|
||||
@@ -1031,7 +1029,7 @@ void Viewport::measure()
|
||||
_cur_aftY = _view.hover_point().y();
|
||||
_edge_hit = false;
|
||||
}
|
||||
} else if (dsoSig = dynamic_pointer_cast<view::DsoSignal>(s)) {
|
||||
} else if ((dsoSig = dynamic_pointer_cast<view::DsoSignal>(s))) {
|
||||
if (_measure_en && dsoSig->measure(_view.hover_point())) {
|
||||
_measure_type = DSO_VALUE;
|
||||
break;
|
||||
@@ -1116,7 +1114,7 @@ void Viewport::paintMeasure(QPainter &p)
|
||||
_measure_type == DSO_VALUE) {
|
||||
BOOST_FOREACH(const boost::shared_ptr<Signal> s, sigs) {
|
||||
boost::shared_ptr<view::DsoSignal> dsoSig;
|
||||
if (dsoSig = dynamic_pointer_cast<view::DsoSignal>(s)) {
|
||||
if ((dsoSig = dynamic_pointer_cast<view::DsoSignal>(s))) {
|
||||
uint64_t index;
|
||||
double value;
|
||||
QPointF hpoint;
|
||||
@@ -1175,7 +1173,7 @@ void Viewport::paintMeasure(QPainter &p)
|
||||
if (_dso_ym_valid) {
|
||||
BOOST_FOREACH(const boost::shared_ptr<Signal> s, sigs) {
|
||||
boost::shared_ptr<view::DsoSignal> dsoSig;
|
||||
if (dsoSig = dynamic_pointer_cast<view::DsoSignal>(s)) {
|
||||
if ((dsoSig = dynamic_pointer_cast<view::DsoSignal>(s))) {
|
||||
if (dsoSig->get_index() == _dso_ym_sig_index) {
|
||||
p.setPen(QPen(dsoSig->get_colour(), 1, Qt::DotLine));
|
||||
const int text_height = p.boundingRect(0, 0, INT_MAX, INT_MAX,
|
||||
|
||||
@@ -100,6 +100,8 @@ public:
|
||||
|
||||
void clear_measure();
|
||||
|
||||
void clear_dso_xm();
|
||||
|
||||
void set_need_update(bool update);
|
||||
|
||||
bool get_dso_trig_moved() const;
|
||||
@@ -114,6 +116,7 @@ private:
|
||||
void mouseDoubleClickEvent(QMouseEvent *event);
|
||||
void wheelEvent(QWheelEvent *event);
|
||||
void leaveEvent(QEvent *);
|
||||
void resizeEvent(QResizeEvent *e);
|
||||
|
||||
void paintSignals(QPainter& p);
|
||||
void paintProgress(QPainter& p);
|
||||
@@ -139,6 +142,8 @@ private:
|
||||
View_type _type;
|
||||
bool _need_update;
|
||||
|
||||
QPixmap *_pixmap;
|
||||
|
||||
uint64_t _sample_received;
|
||||
QPoint _mouse_point;
|
||||
QPoint _mouse_down_point;
|
||||
@@ -147,7 +152,7 @@ private:
|
||||
int64_t _curOffset;
|
||||
int _curSignalHeight;
|
||||
|
||||
QPixmap pixmap;
|
||||
//QPixmap pixmap;
|
||||
|
||||
bool _measure_en;
|
||||
ActionType _action_type;
|
||||
|
||||
Reference in New Issue
Block a user