Skip to content

Commit 856e180

Browse files
Improve the hardware abstraction layer
1 parent c7cba6a commit 856e180

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+2751
-2950
lines changed

DSView/DSView.qrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,6 @@
6666
<file>icons/manual.png</file>
6767
<file>icons/bug.png</file>
6868
<file>icons/support.png</file>
69+
<file>icons/showDoc.png</file>
6970
</qresource>
7071
</RCC>

DSView/icons/showDoc.png

37.3 KB
Loading

DSView/main.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
#include <QFile>
3434
#include <QDir>
3535
#include <QTranslator>
36+
#include <QSettings>
37+
#include <QDesktopServices>
3638

3739
#include "dsapplication.h"
3840
#include "pv/devicemanager.h"
@@ -158,6 +160,7 @@ int main(int argc, char *argv[])
158160
qss.close();
159161
w.show();
160162
w.readSettings();
163+
w.show_doc();
161164

162165
// Run the application
163166
ret = a.exec();

DSView/pv/data/analogsnapshot.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,9 +273,9 @@ void AnalogSnapshot::append_payload_to_envelope_levels()
273273

274274
// Break off if there are no new samples to compute
275275
if (e0.ring_length == prev_length)
276-
return;
276+
continue;
277277
if (e0.length == 0)
278-
return;
278+
continue;
279279

280280
reallocate_envelope(e0);
281281

DSView/pv/data/mathstack.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ void MathStack::calc_fft()
174174
boost::shared_ptr<pv::data::Dso> data;
175175
boost::shared_ptr<pv::view::DsoSignal> dsoSig;
176176
BOOST_FOREACH(const boost::shared_ptr<view::Signal> s, _session.get_signals()) {
177-
if (dsoSig = dynamic_pointer_cast<view::DsoSignal>(s)) {
177+
if ((dsoSig = dynamic_pointer_cast<view::DsoSignal>(s))) {
178178
if (dsoSig->get_index() == _index && dsoSig->enabled()) {
179179
data = dsoSig->dso_data();
180180
break;

DSView/pv/device/device.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,12 @@ QString Device::format_device_title() const
6969

7070
assert(_sdi);
7171

72-
if (_sdi->vendor && _sdi->vendor[0]) {
73-
s << _sdi->vendor;
74-
if ((_sdi->model && _sdi->model[0]) ||
75-
(_sdi->version && _sdi->version[0]))
76-
s << ' ';
77-
}
72+
// if (_sdi->vendor && _sdi->vendor[0]) {
73+
// s << _sdi->vendor;
74+
// if ((_sdi->model && _sdi->model[0]) ||
75+
// (_sdi->version && _sdi->version[0]))
76+
// s << ' ';
77+
// }
7878

7979
if (_sdi->model && _sdi->model[0]) {
8080
s << _sdi->model;

DSView/pv/device/devinst.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ double DevInst::get_sample_time()
174174
return sample_time;
175175
}
176176

177-
GSList* DevInst::get_dev_mode_list()
177+
const GSList* DevInst::get_dev_mode_list()
178178
{
179179
assert(_owner);
180180
sr_dev_inst *const sdi = dev_inst();

DSView/pv/device/devinst.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ class DevInst : public QObject
107107
* @return The returned device mode list from the driver, or NULL if the
108108
* mode list could not be read.
109109
*/
110-
GSList* get_dev_mode_list();
110+
const GSList *get_dev_mode_list();
111111

112112
/**
113113
* @brief Get the device name from the driver

DSView/pv/dialogs/about.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ About::About(QWidget *parent) :
5858

5959
QString thanks = tr("<font size=16>Special Thanks</font><br />"
6060
"<a href=\"%1\" style=\"color:#C0C0C0\">All backers on kickstarter</a><br />"
61-
"<a href=\"%1\" style=\"color:#C0C0C0\">All members of Sigrok project</a><br />"
62-
"All contributors of open-source projects</a><br />"
61+
"<a href=\"%2\" style=\"color:#C0C0C0\">All members of Sigrok project</a><br />"
62+
"All contributors of all open-source projects</a><br />"
6363
"<br /><br />")
6464
.arg("https://www.kickstarter.com/projects/dreamsourcelab/dslogic-multifunction-instruments-for-everyone")
6565
.arg("http://sigrok.org/");

DSView/pv/dialogs/deviceoptions.cpp

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,11 @@ DeviceOptions::DeviceOptions(QWidget *parent, boost::shared_ptr<pv::device::DevI
4848
_props_box->setLayout(get_property_form(_props_box));
4949
_layout.addWidget(_props_box);
5050

51-
QGroupBox *dynamic_box = new QGroupBox(dynamic_widget(_dynamic_layout),
51+
_dynamic_box = new QGroupBox(dynamic_widget(_dynamic_layout),
5252
this);
53-
dynamic_box->setLayout(&_dynamic_layout);
54-
_layout.addWidget(dynamic_box);
53+
_dynamic_box->setLayout(&_dynamic_layout);
54+
_layout.addWidget(_dynamic_box);
55+
_dynamic_box->setVisible(_dynamic_box->title() != NULL);
5556

5657
_layout.addStretch(1);
5758
_layout.addWidget(&_button_box);
@@ -333,6 +334,7 @@ void DeviceOptions::mode_check()
333334

334335
if (mode != _mode) {
335336
dynamic_widget(_dynamic_layout);
337+
_dynamic_box->setVisible(_dynamic_box->title() != NULL);
336338
_mode = mode;
337339
}
338340
}
@@ -356,9 +358,12 @@ void DeviceOptions::mode_check()
356358
void DeviceOptions::channel_check()
357359
{
358360
QRadioButton* sc=dynamic_cast<QRadioButton*>(sender());
361+
QString text = sc->text();
362+
text.remove('&');
359363
if(sc != NULL)
360-
_dev_inst->set_config(NULL, NULL, SR_CONF_CHANNEL_MODE, g_variant_new_string(sc->text().toUtf8().data()));
364+
_dev_inst->set_config(NULL, NULL, SR_CONF_CHANNEL_MODE, g_variant_new_string(text.toUtf8().data()));
361365
dynamic_widget(_dynamic_layout);
366+
_dynamic_box->setVisible(_dynamic_box->title() != NULL);
362367
}
363368

364369
void DeviceOptions::channel_enable()
@@ -424,20 +429,27 @@ QString DeviceOptions::dynamic_widget(QGridLayout& inner_layout) {
424429
logic_probes(inner_layout);
425430
return tr("Channels");
426431
} else if (_dev_inst->dev_inst()->mode == DSO) {
427-
_config_button = new QPushButton(tr("Auto Calibration"), this);
428-
inner_layout.addWidget(_config_button, 0, 0, 1, 1);
429-
connect(_config_button, SIGNAL(clicked()), this, SLOT(zero_adj()));
430-
_cali_button = new QPushButton(tr("Manual Calibration"), this);
431-
inner_layout.addWidget(_cali_button, 1, 0, 1, 1);
432-
connect(_cali_button, SIGNAL(clicked()), this, SLOT(on_calibration()));
433-
434-
return tr("Calibration");
432+
GVariant* gvar = _dev_inst->get_config(NULL, NULL, SR_CONF_HAVE_ZERO);
433+
if (gvar != NULL) {
434+
bool have_zero = g_variant_get_boolean(gvar);
435+
g_variant_unref(gvar);
436+
437+
if (have_zero) {
438+
_config_button = new QPushButton(tr("Auto Calibration"), this);
439+
inner_layout.addWidget(_config_button, 0, 0, 1, 1);
440+
connect(_config_button, SIGNAL(clicked()), this, SLOT(zero_adj()));
441+
_cali_button = new QPushButton(tr("Manual Calibration"), this);
442+
inner_layout.addWidget(_cali_button, 1, 0, 1, 1);
443+
connect(_cali_button, SIGNAL(clicked()), this, SLOT(on_calibration()));
444+
445+
return tr("Calibration");
446+
}
447+
}
435448
} else if (_dev_inst->dev_inst()->mode == ANALOG) {
436449
analog_probes(inner_layout);
437450
return tr("Channels");
438-
} else {
439-
return tr("Undefined");
440451
}
452+
return NULL;
441453
}
442454

443455
void DeviceOptions::analog_probes(QGridLayout &layout)

0 commit comments

Comments
 (0)