kopia lustrzana https://gitlab.com/Teuniz/DSRemote
Work in progress.
rodzic
9142382a61
commit
225fba66a3
|
@ -29,6 +29,7 @@ HEADERS += settings_dialog.h
|
|||
|
||||
SOURCES += main.cpp
|
||||
SOURCES += mainwindow.cpp
|
||||
SOURCES += mainwindow_constr.cpp
|
||||
SOURCES += timer_handlers.cpp
|
||||
SOURCES += save_data.cpp
|
||||
SOURCES += interface.cpp
|
||||
|
|
167
interface.cpp
167
interface.cpp
|
@ -30,9 +30,11 @@
|
|||
|
||||
void UI_Mainwindow::navDialChanged(int npos)
|
||||
{
|
||||
int mpr = 1;
|
||||
|
||||
char str[512];
|
||||
|
||||
double val;
|
||||
double val, lefttime, righttime, delayrange;
|
||||
|
||||
if(navDial->isSliderDown() == true)
|
||||
{
|
||||
|
@ -43,71 +45,109 @@ void UI_Mainwindow::navDialChanged(int npos)
|
|||
navDial_timer->start(300);
|
||||
}
|
||||
|
||||
if(npos > 93)
|
||||
{
|
||||
mpr = 64;
|
||||
}
|
||||
else if(npos > 86)
|
||||
{
|
||||
mpr = 32;
|
||||
}
|
||||
else if(npos > 79)
|
||||
{
|
||||
mpr = 16;
|
||||
}
|
||||
else if(npos > 72)
|
||||
{
|
||||
mpr = 8;
|
||||
}
|
||||
else if(npos > 65)
|
||||
{
|
||||
mpr = 4;
|
||||
}
|
||||
else if(npos > 58)
|
||||
{
|
||||
mpr = 2;
|
||||
}
|
||||
else if(npos > 51)
|
||||
{
|
||||
mpr = 1;
|
||||
}
|
||||
else if(npos > 49)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else if(npos > 42)
|
||||
{
|
||||
mpr = -1;
|
||||
}
|
||||
else if(npos > 35)
|
||||
{
|
||||
mpr = -2;
|
||||
}
|
||||
else if(npos > 28)
|
||||
{
|
||||
mpr = -4;
|
||||
}
|
||||
else if(npos > 21)
|
||||
{
|
||||
mpr = -8;
|
||||
}
|
||||
else if(npos > 14)
|
||||
{
|
||||
mpr = -16;
|
||||
}
|
||||
else if(npos > 7)
|
||||
{
|
||||
mpr = -32;
|
||||
}
|
||||
else
|
||||
{
|
||||
mpr = -64;
|
||||
}
|
||||
|
||||
if(devparms.timebasedelayenable)
|
||||
{
|
||||
val = get_stepsize_divide_by_1000(devparms.timebasedelayoffset);
|
||||
|
||||
devparms.timebasedelayoffset += (val * mpr);
|
||||
|
||||
lefttime = (7 * devparms.timebasescale) - devparms.timebaseoffset;
|
||||
|
||||
righttime = (7 * devparms.timebasescale) + devparms.timebaseoffset;
|
||||
|
||||
delayrange = 7 * devparms.timebasedelayscale;
|
||||
|
||||
if(devparms.timebasedelayoffset < -(lefttime - delayrange))
|
||||
{
|
||||
devparms.timebasedelayoffset = -(lefttime - delayrange);
|
||||
}
|
||||
|
||||
if(devparms.timebasedelayoffset > (righttime - delayrange))
|
||||
{
|
||||
devparms.timebasedelayoffset = (righttime - delayrange);
|
||||
}
|
||||
|
||||
strcpy(str, "Delayed timebase position: ");
|
||||
|
||||
convert_to_metric_suffix(str + strlen(str), devparms.timebasedelayoffset, 2);
|
||||
|
||||
strcat(str, "s");
|
||||
|
||||
statusLabel->setText(str);
|
||||
|
||||
sprintf(str, ":TIM:DEL:OFFS %e", devparms.timebasedelayoffset);
|
||||
|
||||
tmcdev_write(device, str);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if(navDialFunc == NAV_DIAL_FUNC_HOLDOFF)
|
||||
{
|
||||
val = get_stepsize_divide_by_1000(devparms.triggerholdoff);
|
||||
|
||||
if(npos > 93)
|
||||
{
|
||||
devparms.triggerholdoff += (val * 64);
|
||||
}
|
||||
else if(npos > 86)
|
||||
{
|
||||
devparms.triggerholdoff += (val * 32);
|
||||
}
|
||||
else if(npos > 79)
|
||||
{
|
||||
devparms.triggerholdoff += (val * 16);
|
||||
}
|
||||
else if(npos > 72)
|
||||
{
|
||||
devparms.triggerholdoff += (val * 8);
|
||||
}
|
||||
else if(npos > 65)
|
||||
{
|
||||
devparms.triggerholdoff += (val * 4);
|
||||
}
|
||||
else if(npos > 58)
|
||||
{
|
||||
devparms.triggerholdoff += (val * 2);
|
||||
}
|
||||
else if(npos > 51)
|
||||
{
|
||||
devparms.triggerholdoff += val;
|
||||
}
|
||||
else if(npos > 49)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else if(npos > 42)
|
||||
{
|
||||
devparms.triggerholdoff -= val;
|
||||
}
|
||||
else if(npos > 35)
|
||||
{
|
||||
devparms.triggerholdoff -= (val * 2);
|
||||
}
|
||||
else if(npos > 28)
|
||||
{
|
||||
devparms.triggerholdoff -= (val * 4);
|
||||
}
|
||||
else if(npos > 21)
|
||||
{
|
||||
devparms.triggerholdoff -= (val * 8);
|
||||
}
|
||||
else if(npos > 14)
|
||||
{
|
||||
devparms.triggerholdoff -= (val * 16);
|
||||
}
|
||||
else if(npos > 7)
|
||||
{
|
||||
devparms.triggerholdoff -= (val * 32);
|
||||
}
|
||||
else
|
||||
{
|
||||
devparms.triggerholdoff -= (val * 64);
|
||||
}
|
||||
|
||||
devparms.triggerholdoff += (val * mpr);
|
||||
|
||||
if(devparms.triggerholdoff < 1e-7)
|
||||
{
|
||||
|
@ -154,7 +194,8 @@ void UI_Mainwindow::saveButtonClicked()
|
|||
{
|
||||
QMenu menu;
|
||||
|
||||
menu.addAction("Save waveform", this, SLOT(save_waveform()));
|
||||
menu.addAction("Save screen waveform", this, SLOT(save_screen_waveform()));
|
||||
// menu.addAction("Save memory waveform", this, SLOT(save_memory_waveform()));
|
||||
menu.addAction("Save screenshot", this, SLOT(save_screenshot()));
|
||||
|
||||
menu.exec(saveButton->mapToGlobal(QPoint(0,0)));
|
||||
|
|
388
mainwindow.cpp
388
mainwindow.cpp
|
@ -27,399 +27,13 @@
|
|||
|
||||
|
||||
#include "mainwindow.h"
|
||||
#include "mainwindow_constr.cpp"
|
||||
#include "timer_handlers.cpp"
|
||||
#include "save_data.cpp"
|
||||
#include "interface.cpp"
|
||||
|
||||
|
||||
|
||||
UI_Mainwindow::UI_Mainwindow()
|
||||
{
|
||||
int i;
|
||||
|
||||
setMinimumSize(1170, 630);
|
||||
setWindowTitle(PROGRAM_NAME " " PROGRAM_VERSION);
|
||||
setWindowIcon(QIcon(":/images/r.png"));
|
||||
|
||||
appfont = new QFont;
|
||||
|
||||
monofont = new QFont;
|
||||
|
||||
appfont->setFamily("Arial");
|
||||
appfont->setPixelSize(12);
|
||||
|
||||
monofont->setFamily("andale mono");
|
||||
monofont->setPixelSize(12);
|
||||
|
||||
QApplication::setFont(*appfont);
|
||||
|
||||
setlocale(LC_NUMERIC, "C");
|
||||
|
||||
QCoreApplication::setOrganizationName("TvB");
|
||||
QCoreApplication::setOrganizationDomain("teuniz.net");
|
||||
QCoreApplication::setApplicationName(PROGRAM_NAME);
|
||||
|
||||
memset(&devparms, 0, sizeof(struct device_settings));
|
||||
|
||||
devparms.screenshot_buf = (char *)malloc(1024 * 1024 * 2);
|
||||
|
||||
for(i=0; i< MAX_CHNS; i++)
|
||||
{
|
||||
devparms.wavebuf[i] = (char *)malloc(WAVFRM_MAX_BUFSZ);
|
||||
}
|
||||
|
||||
devparms.displaygrid = 2;
|
||||
|
||||
devparms.channel_cnt = 4;
|
||||
|
||||
devparms.timebasescale = 1;
|
||||
|
||||
menubar = menuBar();
|
||||
|
||||
devicemenu = new QMenu;
|
||||
devicemenu->setTitle("Device");
|
||||
devicemenu->addAction("Connect", this, SLOT(open_connection()));
|
||||
devicemenu->addAction("Disconnect", this, SLOT(close_connection()));
|
||||
devicemenu->addAction("Exit", this, SLOT(close()), QKeySequence::Quit);
|
||||
menubar->addMenu(devicemenu);
|
||||
|
||||
menubar->addAction("Settings", this, SLOT(open_settings_dialog()));
|
||||
|
||||
helpmenu = new QMenu;
|
||||
helpmenu->setTitle("Help");
|
||||
helpmenu->addAction("About", this, SLOT(show_about_dialog()));
|
||||
menubar->addMenu(helpmenu);
|
||||
|
||||
statusLabel = new QLabel;
|
||||
|
||||
mainLabel = new QLabel();
|
||||
|
||||
vlayout1 = new QVBoxLayout;
|
||||
vlayout1->addWidget(mainLabel);
|
||||
|
||||
waveForm = new SignalCurve(this);
|
||||
waveForm->setBackgroundColor(Qt::black);
|
||||
waveForm->setSignalColor1(Qt::yellow);
|
||||
waveForm->setSignalColor2(Qt::cyan);
|
||||
waveForm->setSignalColor3(Qt::magenta);
|
||||
waveForm->setSignalColor4(QColor(0, 128, 255));
|
||||
waveForm->setRasterColor(Qt::darkGray);
|
||||
waveForm->setBorderSize(40);
|
||||
waveForm->setDeviceParameters(&devparms);
|
||||
|
||||
setCentralWidget(waveForm);
|
||||
|
||||
statusBar = new QStatusBar;
|
||||
setStatusBar(statusBar);
|
||||
statusBar->addPermanentWidget(statusLabel, 100);
|
||||
statusLabel->setText("Disconnected");
|
||||
|
||||
DPRwidget = new QWidget;
|
||||
|
||||
adjDialLabel = new QLabel(DPRwidget);
|
||||
adjDialLabel->setGeometry(20, 0, 40, 18);
|
||||
adjDialLabel->setStyleSheet("font: 7pt;");
|
||||
adjDial = new QDial(DPRwidget);
|
||||
adjDial->setWrapping(true);
|
||||
adjDial->setNotchesVisible(true);
|
||||
adjDial->setGeometry(15, 15, 40, 40);
|
||||
adjDial->setSingleStep(1);
|
||||
adjDial->setMaximum(100);
|
||||
adjDial->setMinimum(0);
|
||||
adjDial->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
|
||||
navDial = new QDial(DPRwidget);
|
||||
navDial->setWrapping(false);
|
||||
navDial->setNotchesVisible(true);
|
||||
navDial->setGeometry(70, 80, 80, 80);
|
||||
navDial->setSingleStep(1);
|
||||
navDial->setMaximum(100);
|
||||
navDial->setMinimum(0);
|
||||
navDial->setValue(50);
|
||||
navDial->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
|
||||
clearButton = new QPushButton(DPRwidget);
|
||||
def_stylesh = clearButton->styleSheet();
|
||||
clearButton->setGeometry(70, 15, 40, 18);
|
||||
clearButton->setText("Clear");
|
||||
autoButton = new QPushButton(DPRwidget);
|
||||
autoButton->setGeometry(125, 15, 40, 18);
|
||||
autoButton->setText("Auto");
|
||||
autoButton->setStyleSheet("background: #66FF99;");
|
||||
runButton = new QPushButton(DPRwidget);
|
||||
runButton->setGeometry(180, 15, 70, 18);
|
||||
runButton->setText("Run/Stop");
|
||||
singleButton = new QPushButton(DPRwidget);
|
||||
singleButton->setGeometry(265, 15, 40, 18);
|
||||
singleButton->setText("Single");
|
||||
|
||||
playpauseButton = new QPushButton(DPRwidget);
|
||||
playpauseButton->setGeometry(20, 75, 25, 25);
|
||||
playpauseButton->setStyleSheet("background-image: url(:/images/playpause.png);");
|
||||
stopButton = new QPushButton(DPRwidget);
|
||||
stopButton->setGeometry(20, 110, 25, 25);
|
||||
stopButton->setStyleSheet("background-image: url(:/images/stop.png);");
|
||||
recordButton = new QPushButton(DPRwidget);
|
||||
recordButton->setGeometry(20, 145, 25, 25);
|
||||
recordButton->setStyleSheet("background-image: url(:/images/record.png);");
|
||||
|
||||
menuGrpBox = new QGroupBox("Menu", DPRwidget);
|
||||
menuGrpBox->setGeometry(180, 60, 125, 120);
|
||||
|
||||
acqButton = new QPushButton(menuGrpBox);
|
||||
acqButton->setGeometry(15, 20, 40, 18);
|
||||
acqButton->setText("acq");
|
||||
cursButton = new QPushButton(menuGrpBox);
|
||||
cursButton->setGeometry(70, 20, 40, 18);
|
||||
cursButton->setText("curs");
|
||||
saveButton = new QPushButton(menuGrpBox);
|
||||
saveButton->setGeometry(15, 55, 40, 18);
|
||||
saveButton->setText("save");
|
||||
dispButton = new QPushButton(menuGrpBox);
|
||||
dispButton->setGeometry(70, 55, 40, 18);
|
||||
dispButton->setText("disp");
|
||||
utilButton = new QPushButton(menuGrpBox);
|
||||
utilButton->setGeometry(15, 90, 40, 18);
|
||||
utilButton->setText("util");
|
||||
helpButton = new QPushButton(menuGrpBox);
|
||||
helpButton->setGeometry(70, 90, 40, 18);
|
||||
helpButton->setText("help");
|
||||
|
||||
horizontalGrpBox = new QGroupBox("Horizontal", DPRwidget);
|
||||
horizontalGrpBox->setGeometry(5, 190, 180, 90);
|
||||
|
||||
horScaleLabel = new QLabel(horizontalGrpBox);
|
||||
horScaleLabel->setGeometry(20, 18, 40, 18);
|
||||
horScaleLabel->setText("Scale");
|
||||
horScaleLabel->setStyleSheet("font: 7pt;");
|
||||
horScaleDial = new QDial(horizontalGrpBox);
|
||||
horScaleDial->setGeometry(10, 35, 50, 50);
|
||||
horScaleDial->setWrapping(true);
|
||||
horScaleDial->setNotchesVisible(true);
|
||||
horScaleDial->setSingleStep(1);
|
||||
horScaleDial->setMaximum(100);
|
||||
horScaleDial->setMinimum(0);
|
||||
horScaleDial->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
horMenuButton = new QPushButton(horizontalGrpBox);
|
||||
horMenuButton->setGeometry(70, 51, 40, 18);
|
||||
horMenuButton->setText("Menu");
|
||||
horPosLabel = new QLabel(horizontalGrpBox);
|
||||
horPosLabel->setGeometry(128, 21, 40, 18);
|
||||
horPosLabel->setText("Position");
|
||||
horPosLabel->setStyleSheet("font: 7pt;");
|
||||
horPosDial = new QDial(horizontalGrpBox);
|
||||
horPosDial->setGeometry(125, 40, 40, 40);
|
||||
horPosDial->setWrapping(true);
|
||||
horPosDial->setNotchesVisible(true);
|
||||
horPosDial->setSingleStep(1);
|
||||
horPosDial->setMaximum(100);
|
||||
horPosDial->setMinimum(0);
|
||||
horPosDial->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
|
||||
quickGrpBox = new QGroupBox("Quick", DPRwidget);
|
||||
quickGrpBox->setGeometry(195, 190, 70, 90);
|
||||
|
||||
measureButton = new QPushButton(quickGrpBox);
|
||||
measureButton->setGeometry(15, 30, 40, 18);
|
||||
measureButton->setText("MEAS");
|
||||
|
||||
verticalGrpBox = new QGroupBox("Vertical", DPRwidget);
|
||||
verticalGrpBox->setGeometry(5, 290, 140, 255);
|
||||
|
||||
ch1InputLabel = new QLabel(verticalGrpBox);
|
||||
ch1InputLabel->setGeometry(12, 15, 50, 18);
|
||||
ch1InputLabel->setStyleSheet("color: #C0C000; font: 7pt;");
|
||||
ch1Button = new QPushButton(verticalGrpBox);
|
||||
ch1Button->setGeometry(15, 30, 40, 18);
|
||||
ch1Button->setText("CH1");
|
||||
ch2InputLabel = new QLabel(verticalGrpBox);
|
||||
ch2InputLabel->setGeometry(12, 55, 50, 18);
|
||||
ch2InputLabel->setStyleSheet("color: #C0C000; font: 7pt;");
|
||||
ch2Button = new QPushButton(verticalGrpBox);
|
||||
ch2Button->setGeometry(15, 70, 40, 18);
|
||||
ch2Button->setText("CH2");
|
||||
ch3InputLabel = new QLabel(verticalGrpBox);
|
||||
ch3InputLabel->setGeometry(12, 95, 50, 18);
|
||||
ch3InputLabel->setStyleSheet("color: #C0C000; font: 7pt;");
|
||||
ch3Button = new QPushButton(verticalGrpBox);
|
||||
ch3Button->setGeometry(15, 110, 40, 18);
|
||||
ch3Button->setText("CH3");
|
||||
ch4InputLabel = new QLabel(verticalGrpBox);
|
||||
ch4InputLabel->setGeometry(12, 135, 50, 18);
|
||||
ch4InputLabel->setStyleSheet("color: #C0C000; font: 7pt;");
|
||||
ch4Button = new QPushButton(verticalGrpBox);
|
||||
ch4Button->setGeometry(15, 150, 40, 18);
|
||||
ch4Button->setText("CH4");
|
||||
chanMenuButton = new QPushButton(verticalGrpBox);
|
||||
chanMenuButton->setGeometry(15, 190, 40, 18);
|
||||
chanMenuButton->setText("Menu");
|
||||
vertOffsetLabel = new QLabel(verticalGrpBox);
|
||||
vertOffsetLabel->setGeometry(80, 30, 40, 18);
|
||||
vertOffsetLabel->setStyleSheet("font: 7pt;");
|
||||
vertOffsetLabel->setText("Position");
|
||||
vertOffsetDial = new QDial(verticalGrpBox);
|
||||
vertOffsetDial->setGeometry(75, 50, 40, 40);
|
||||
vertOffsetDial->setWrapping(true);
|
||||
vertOffsetDial->setNotchesVisible(true);
|
||||
vertOffsetDial->setSingleStep(1);
|
||||
vertOffsetDial->setMaximum(100);
|
||||
vertOffsetDial->setMinimum(0);
|
||||
vertOffsetDial->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
vertScaleLabel = new QLabel(verticalGrpBox);
|
||||
vertScaleLabel->setGeometry(80, 103, 40, 18);
|
||||
vertScaleLabel->setStyleSheet("font: 7pt;");
|
||||
vertScaleLabel->setText("Scale");
|
||||
vertScaleDial = new QDial(verticalGrpBox);
|
||||
vertScaleDial->setGeometry(70, 120, 50, 50);
|
||||
vertScaleDial->setWrapping(true);
|
||||
vertScaleDial->setNotchesVisible(true);
|
||||
vertScaleDial->setSingleStep(1);
|
||||
vertScaleDial->setMaximum(100);
|
||||
vertScaleDial->setMinimum(0);
|
||||
vertScaleDial->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
|
||||
triggerGrpBox = new QGroupBox("Trigger", DPRwidget);
|
||||
triggerGrpBox->setGeometry(155, 290, 100, 255);
|
||||
|
||||
trigModeLabel = new QLabel(triggerGrpBox);
|
||||
trigModeLabel->setGeometry(10, 20, 100, 18);
|
||||
trigModeLabel->setText("Auto Normal Single");
|
||||
trigModeLabel->setStyleSheet("font: 7pt;");
|
||||
trigModeAutoLed = new TLed(triggerGrpBox);
|
||||
trigModeAutoLed->setGeometry(20, 45, 10, 10);
|
||||
trigModeAutoLed->setOnColor(Qt::yellow);
|
||||
trigModeAutoLed->setOffColor(Qt::lightGray);
|
||||
trigModeNormLed = new TLed(triggerGrpBox);
|
||||
trigModeNormLed->setGeometry(45, 45, 10, 10);
|
||||
trigModeNormLed->setOnColor(Qt::yellow);
|
||||
trigModeNormLed->setOffColor(Qt::lightGray);
|
||||
trigModeSingLed = new TLed(triggerGrpBox);
|
||||
trigModeSingLed->setGeometry(70, 45, 10, 10);
|
||||
trigModeSingLed->setOnColor(Qt::yellow);
|
||||
trigModeSingLed->setOffColor(Qt::lightGray);
|
||||
trigModeButton = new QPushButton(triggerGrpBox);
|
||||
trigModeButton->setGeometry(30, 65, 40, 18);
|
||||
trigModeButton->setText("Mode");
|
||||
trigLevelLabel = new QLabel(triggerGrpBox);
|
||||
trigLevelLabel->setGeometry(34, 92, 40, 18);
|
||||
trigLevelLabel->setText("Level");
|
||||
trigAdjustDial = new QDial(triggerGrpBox);
|
||||
trigAdjustDial->setGeometry(30, 110, 40, 40);
|
||||
trigAdjustDial->setWrapping(true);
|
||||
trigAdjustDial->setNotchesVisible(true);
|
||||
trigAdjustDial->setSingleStep(1);
|
||||
trigAdjustDial->setMaximum(100);
|
||||
trigAdjustDial->setMinimum(0);
|
||||
trigAdjustDial->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
trigMenuButton = new QPushButton(triggerGrpBox);
|
||||
trigMenuButton->setGeometry(30, 160, 40, 18);
|
||||
trigMenuButton->setText("Menu");
|
||||
trigForceButton = new QPushButton(triggerGrpBox);
|
||||
trigForceButton->setGeometry(30, 190, 40, 18);
|
||||
trigForceButton->setText("Force");
|
||||
trig50pctButton = new QPushButton(triggerGrpBox);
|
||||
trig50pctButton->setGeometry(30, 220, 40, 18);
|
||||
trig50pctButton->setText("50\%");
|
||||
|
||||
dockPanelRight = new QDockWidget(this);
|
||||
dockPanelRight->setFeatures(QDockWidget::DockWidgetFloatable);
|
||||
dockPanelRight->setAllowedAreas(Qt::RightDockWidgetArea);
|
||||
dockPanelRight->setWidget(DPRwidget);
|
||||
dockPanelRight->setMinimumWidth(350);
|
||||
dockPanelRight->setMinimumHeight(400);
|
||||
addDockWidget(Qt::RightDockWidgetArea, dockPanelRight);
|
||||
|
||||
DPRwidget->setEnabled(false);
|
||||
|
||||
recent_dir[0] = 0;
|
||||
|
||||
recent_savedir[0] = 0;
|
||||
|
||||
device = NULL;
|
||||
|
||||
QSettings settings;
|
||||
|
||||
strcpy(recent_savedir, settings.value("path/savedir").toString().toLocal8Bit().data());
|
||||
|
||||
adjDialFunc = ADJ_DIAL_FUNC_NONE;
|
||||
navDialFunc = NAV_DIAL_FUNC_NONE;
|
||||
|
||||
scrn_timer = new QTimer(this);
|
||||
stat_timer = new QTimer(this);
|
||||
adjdial_timer = new QTimer(this);
|
||||
navDial_timer = new QTimer(this);
|
||||
navDial_timer->setSingleShot(true);
|
||||
test_timer = new QTimer(this);
|
||||
|
||||
connect(scrn_timer, SIGNAL(timeout()), this, SLOT(scrn_timer_handler()));
|
||||
connect(stat_timer, SIGNAL(timeout()), this, SLOT(stat_timer_handler()));
|
||||
connect(adjdial_timer, SIGNAL(timeout()), this, SLOT(adjdial_timer_handler()));
|
||||
connect(navDial, SIGNAL(sliderReleased()), this, SLOT(navDialReleased()));
|
||||
connect(navDial_timer, SIGNAL(timeout()), this, SLOT(navDial_timer_handler()));
|
||||
connect(test_timer, SIGNAL(timeout()), this, SLOT(test_timer_handler()));
|
||||
|
||||
///// TEST /////////////////////////////////////
|
||||
// DPRwidget->setEnabled(true);
|
||||
//
|
||||
// connect(adjDial, SIGNAL(valueChanged(int)), this, SLOT(adjDialChanged(int)));
|
||||
// connect(trigAdjustDial, SIGNAL(valueChanged(int)), this, SLOT(trigAdjustDialChanged(int)));
|
||||
// connect(horScaleDial, SIGNAL(valueChanged(int)), this, SLOT(horScaleDialChanged(int)));
|
||||
// connect(horPosDial, SIGNAL(valueChanged(int)), this, SLOT(horPosDialChanged(int)));
|
||||
// connect(vertOffsetDial, SIGNAL(valueChanged(int)), this, SLOT(vertOffsetDialChanged(int)));
|
||||
// connect(vertScaleDial, SIGNAL(valueChanged(int)), this, SLOT(vertScaleDialChanged(int)));
|
||||
// connect(navDial, SIGNAL(valueChanged(int)), this, SLOT(navDialChanged(int)));
|
||||
//
|
||||
// connect(ch1Button, SIGNAL(clicked()), this, SLOT(ch1ButtonClicked()));
|
||||
// connect(ch2Button, SIGNAL(clicked()), this, SLOT(ch2ButtonClicked()));
|
||||
// connect(ch3Button, SIGNAL(clicked()), this, SLOT(ch3ButtonClicked()));
|
||||
// connect(ch4Button, SIGNAL(clicked()), this, SLOT(ch4ButtonClicked()));
|
||||
// connect(clearButton, SIGNAL(clicked()), this, SLOT(clearButtonClicked()));
|
||||
// connect(autoButton, SIGNAL(clicked()), this, SLOT(autoButtonClicked()));
|
||||
// connect(runButton, SIGNAL(clicked()), this, SLOT(runButtonClicked()));
|
||||
// connect(singleButton, SIGNAL(clicked()), this, SLOT(singleButtonClicked()));
|
||||
// connect(horMenuButton, SIGNAL(clicked()), this, SLOT(horMenuButtonClicked()));
|
||||
// connect(trigModeButton, SIGNAL(clicked()), this, SLOT(trigModeButtonClicked()));
|
||||
// connect(trigMenuButton, SIGNAL(clicked()), this, SLOT(trigMenuButtonClicked()));
|
||||
// connect(trigForceButton, SIGNAL(clicked()), this, SLOT(trigForceButtonClicked()));
|
||||
// connect(trig50pctButton, SIGNAL(clicked()), this, SLOT(trig50pctButtonClicked()));
|
||||
// connect(acqButton, SIGNAL(clicked()), this, SLOT(acqButtonClicked()));
|
||||
// connect(cursButton, SIGNAL(clicked()), this, SLOT(cursButtonClicked()));
|
||||
// connect(saveButton, SIGNAL(clicked()), this, SLOT(saveButtonClicked()));
|
||||
// connect(dispButton, SIGNAL(clicked()), this, SLOT(dispButtonClicked()));
|
||||
// connect(utilButton, SIGNAL(clicked()), this, SLOT(utilButtonClicked()));
|
||||
// connect(helpButton, SIGNAL(clicked()), this, SLOT(helpButtonClicked()));
|
||||
//
|
||||
// connect(horPosDial, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(horPosDialClicked(QPoint)));
|
||||
// connect(vertOffsetDial, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(vertOffsetDialClicked(QPoint)));
|
||||
// connect(horScaleDial, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(horScaleDialClicked(QPoint)));
|
||||
// connect(vertScaleDial, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(vertScaleDialClicked(QPoint)));
|
||||
// connect(trigAdjustDial, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(trigAdjustDialClicked(QPoint)));
|
||||
// connect(adjDial, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(adjustDialClicked(QPoint)));
|
||||
///// TEST /////////////////////////////////////
|
||||
|
||||
|
||||
show();
|
||||
}
|
||||
|
||||
|
||||
UI_Mainwindow::~UI_Mainwindow()
|
||||
{
|
||||
QSettings settings;
|
||||
|
||||
settings.setValue("path/savedir", recent_savedir);
|
||||
|
||||
delete appfont;
|
||||
delete monofont;
|
||||
|
||||
free(devparms.screenshot_buf);
|
||||
|
||||
for(int i=0; i<MAX_CHNS; i++)
|
||||
{
|
||||
free(devparms.wavebuf[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void UI_Mainwindow::open_settings_dialog()
|
||||
{
|
||||
UI_select_device_window sel_device;
|
||||
|
|
|
@ -211,7 +211,8 @@ private slots:
|
|||
void close_connection();
|
||||
void open_settings_dialog();
|
||||
int get_device_settings();
|
||||
void save_waveform();
|
||||
void save_screen_waveform();
|
||||
void save_memory_waveform();
|
||||
void save_screenshot();
|
||||
|
||||
void adjDialChanged(int);
|
||||
|
|
|
@ -0,0 +1,429 @@
|
|||
/*
|
||||
***************************************************************************
|
||||
*
|
||||
* Author: Teunis van Beelen
|
||||
*
|
||||
* Copyright (C) 2015 Teunis van Beelen
|
||||
*
|
||||
* Email: teuniz@gmail.com
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
***************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
#include "mainwindow.h"
|
||||
|
||||
|
||||
|
||||
UI_Mainwindow::UI_Mainwindow()
|
||||
{
|
||||
int i;
|
||||
|
||||
setMinimumSize(1170, 630);
|
||||
setWindowTitle(PROGRAM_NAME " " PROGRAM_VERSION);
|
||||
setWindowIcon(QIcon(":/images/r.png"));
|
||||
|
||||
appfont = new QFont;
|
||||
|
||||
monofont = new QFont;
|
||||
|
||||
appfont->setFamily("Arial");
|
||||
appfont->setPixelSize(12);
|
||||
|
||||
monofont->setFamily("andale mono");
|
||||
monofont->setPixelSize(12);
|
||||
|
||||
QApplication::setFont(*appfont);
|
||||
|
||||
setlocale(LC_NUMERIC, "C");
|
||||
|
||||
QCoreApplication::setOrganizationName("TvB");
|
||||
QCoreApplication::setOrganizationDomain("teuniz.net");
|
||||
QCoreApplication::setApplicationName(PROGRAM_NAME);
|
||||
|
||||
memset(&devparms, 0, sizeof(struct device_settings));
|
||||
|
||||
devparms.screenshot_buf = (char *)malloc(1024 * 1024 * 2);
|
||||
|
||||
for(i=0; i< MAX_CHNS; i++)
|
||||
{
|
||||
devparms.wavebuf[i] = (char *)malloc(WAVFRM_MAX_BUFSZ);
|
||||
}
|
||||
|
||||
devparms.displaygrid = 2;
|
||||
|
||||
devparms.channel_cnt = 4;
|
||||
|
||||
devparms.timebasescale = 1;
|
||||
|
||||
menubar = menuBar();
|
||||
|
||||
devicemenu = new QMenu;
|
||||
devicemenu->setTitle("Device");
|
||||
devicemenu->addAction("Connect", this, SLOT(open_connection()));
|
||||
devicemenu->addAction("Disconnect", this, SLOT(close_connection()));
|
||||
devicemenu->addAction("Exit", this, SLOT(close()), QKeySequence::Quit);
|
||||
menubar->addMenu(devicemenu);
|
||||
|
||||
menubar->addAction("Settings", this, SLOT(open_settings_dialog()));
|
||||
|
||||
helpmenu = new QMenu;
|
||||
helpmenu->setTitle("Help");
|
||||
helpmenu->addAction("About", this, SLOT(show_about_dialog()));
|
||||
menubar->addMenu(helpmenu);
|
||||
|
||||
statusLabel = new QLabel;
|
||||
|
||||
mainLabel = new QLabel();
|
||||
|
||||
vlayout1 = new QVBoxLayout;
|
||||
vlayout1->addWidget(mainLabel);
|
||||
|
||||
waveForm = new SignalCurve(this);
|
||||
waveForm->setBackgroundColor(Qt::black);
|
||||
waveForm->setSignalColor1(Qt::yellow);
|
||||
waveForm->setSignalColor2(Qt::cyan);
|
||||
waveForm->setSignalColor3(Qt::magenta);
|
||||
waveForm->setSignalColor4(QColor(0, 128, 255));
|
||||
waveForm->setRasterColor(Qt::darkGray);
|
||||
waveForm->setBorderSize(40);
|
||||
waveForm->setDeviceParameters(&devparms);
|
||||
|
||||
setCentralWidget(waveForm);
|
||||
|
||||
statusBar = new QStatusBar;
|
||||
setStatusBar(statusBar);
|
||||
statusBar->addPermanentWidget(statusLabel, 100);
|
||||
statusLabel->setText("Disconnected");
|
||||
|
||||
DPRwidget = new QWidget;
|
||||
|
||||
adjDialLabel = new QLabel(DPRwidget);
|
||||
adjDialLabel->setGeometry(20, 0, 40, 18);
|
||||
adjDialLabel->setStyleSheet("font: 7pt;");
|
||||
adjDial = new QDial(DPRwidget);
|
||||
adjDial->setWrapping(true);
|
||||
adjDial->setNotchesVisible(true);
|
||||
adjDial->setGeometry(15, 15, 40, 40);
|
||||
adjDial->setSingleStep(1);
|
||||
adjDial->setMaximum(100);
|
||||
adjDial->setMinimum(0);
|
||||
adjDial->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
|
||||
navDial = new QDial(DPRwidget);
|
||||
navDial->setWrapping(false);
|
||||
navDial->setNotchesVisible(true);
|
||||
navDial->setGeometry(70, 80, 80, 80);
|
||||
navDial->setSingleStep(1);
|
||||
navDial->setMaximum(100);
|
||||
navDial->setMinimum(0);
|
||||
navDial->setValue(50);
|
||||
navDial->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
|
||||
clearButton = new QPushButton(DPRwidget);
|
||||
def_stylesh = clearButton->styleSheet();
|
||||
clearButton->setGeometry(70, 15, 40, 18);
|
||||
clearButton->setText("Clear");
|
||||
autoButton = new QPushButton(DPRwidget);
|
||||
autoButton->setGeometry(125, 15, 40, 18);
|
||||
autoButton->setText("Auto");
|
||||
autoButton->setStyleSheet("background: #66FF99;");
|
||||
runButton = new QPushButton(DPRwidget);
|
||||
runButton->setGeometry(180, 15, 70, 18);
|
||||
runButton->setText("Run/Stop");
|
||||
singleButton = new QPushButton(DPRwidget);
|
||||
singleButton->setGeometry(265, 15, 40, 18);
|
||||
singleButton->setText("Single");
|
||||
|
||||
playpauseButton = new QPushButton(DPRwidget);
|
||||
playpauseButton->setGeometry(20, 75, 25, 25);
|
||||
playpauseButton->setStyleSheet("background-image: url(:/images/playpause.png);");
|
||||
stopButton = new QPushButton(DPRwidget);
|
||||
stopButton->setGeometry(20, 110, 25, 25);
|
||||
stopButton->setStyleSheet("background-image: url(:/images/stop.png);");
|
||||
recordButton = new QPushButton(DPRwidget);
|
||||
recordButton->setGeometry(20, 145, 25, 25);
|
||||
recordButton->setStyleSheet("background-image: url(:/images/record.png);");
|
||||
|
||||
menuGrpBox = new QGroupBox("Menu", DPRwidget);
|
||||
menuGrpBox->setGeometry(180, 60, 125, 120);
|
||||
|
||||
acqButton = new QPushButton(menuGrpBox);
|
||||
acqButton->setGeometry(15, 20, 40, 18);
|
||||
acqButton->setText("acq");
|
||||
cursButton = new QPushButton(menuGrpBox);
|
||||
cursButton->setGeometry(70, 20, 40, 18);
|
||||
cursButton->setText("curs");
|
||||
saveButton = new QPushButton(menuGrpBox);
|
||||
saveButton->setGeometry(15, 55, 40, 18);
|
||||
saveButton->setText("save");
|
||||
dispButton = new QPushButton(menuGrpBox);
|
||||
dispButton->setGeometry(70, 55, 40, 18);
|
||||
dispButton->setText("disp");
|
||||
utilButton = new QPushButton(menuGrpBox);
|
||||
utilButton->setGeometry(15, 90, 40, 18);
|
||||
utilButton->setText("util");
|
||||
helpButton = new QPushButton(menuGrpBox);
|
||||
helpButton->setGeometry(70, 90, 40, 18);
|
||||
helpButton->setText("help");
|
||||
|
||||
horizontalGrpBox = new QGroupBox("Horizontal", DPRwidget);
|
||||
horizontalGrpBox->setGeometry(5, 190, 180, 90);
|
||||
|
||||
horScaleLabel = new QLabel(horizontalGrpBox);
|
||||
horScaleLabel->setGeometry(20, 18, 40, 18);
|
||||
horScaleLabel->setText("Scale");
|
||||
horScaleLabel->setStyleSheet("font: 7pt;");
|
||||
horScaleDial = new QDial(horizontalGrpBox);
|
||||
horScaleDial->setGeometry(10, 35, 50, 50);
|
||||
horScaleDial->setWrapping(true);
|
||||
horScaleDial->setNotchesVisible(true);
|
||||
horScaleDial->setSingleStep(1);
|
||||
horScaleDial->setMaximum(100);
|
||||
horScaleDial->setMinimum(0);
|
||||
horScaleDial->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
horMenuButton = new QPushButton(horizontalGrpBox);
|
||||
horMenuButton->setGeometry(70, 51, 40, 18);
|
||||
horMenuButton->setText("Menu");
|
||||
horPosLabel = new QLabel(horizontalGrpBox);
|
||||
horPosLabel->setGeometry(128, 21, 40, 18);
|
||||
horPosLabel->setText("Position");
|
||||
horPosLabel->setStyleSheet("font: 7pt;");
|
||||
horPosDial = new QDial(horizontalGrpBox);
|
||||
horPosDial->setGeometry(125, 40, 40, 40);
|
||||
horPosDial->setWrapping(true);
|
||||
horPosDial->setNotchesVisible(true);
|
||||
horPosDial->setSingleStep(1);
|
||||
horPosDial->setMaximum(100);
|
||||
horPosDial->setMinimum(0);
|
||||
horPosDial->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
|
||||
quickGrpBox = new QGroupBox("Quick", DPRwidget);
|
||||
quickGrpBox->setGeometry(195, 190, 70, 90);
|
||||
|
||||
measureButton = new QPushButton(quickGrpBox);
|
||||
measureButton->setGeometry(15, 30, 40, 18);
|
||||
measureButton->setText("Meas");
|
||||
|
||||
verticalGrpBox = new QGroupBox("Vertical", DPRwidget);
|
||||
verticalGrpBox->setGeometry(5, 290, 140, 255);
|
||||
|
||||
ch1InputLabel = new QLabel(verticalGrpBox);
|
||||
ch1InputLabel->setGeometry(12, 15, 50, 18);
|
||||
ch1InputLabel->setStyleSheet("color: #C0C000; font: 7pt;");
|
||||
ch1Button = new QPushButton(verticalGrpBox);
|
||||
ch1Button->setGeometry(15, 30, 40, 18);
|
||||
ch1Button->setText("CH1");
|
||||
ch2InputLabel = new QLabel(verticalGrpBox);
|
||||
ch2InputLabel->setGeometry(12, 55, 50, 18);
|
||||
ch2InputLabel->setStyleSheet("color: #C0C000; font: 7pt;");
|
||||
ch2Button = new QPushButton(verticalGrpBox);
|
||||
ch2Button->setGeometry(15, 70, 40, 18);
|
||||
ch2Button->setText("CH2");
|
||||
ch3InputLabel = new QLabel(verticalGrpBox);
|
||||
ch3InputLabel->setGeometry(12, 95, 50, 18);
|
||||
ch3InputLabel->setStyleSheet("color: #C0C000; font: 7pt;");
|
||||
ch3Button = new QPushButton(verticalGrpBox);
|
||||
ch3Button->setGeometry(15, 110, 40, 18);
|
||||
ch3Button->setText("CH3");
|
||||
ch4InputLabel = new QLabel(verticalGrpBox);
|
||||
ch4InputLabel->setGeometry(12, 135, 50, 18);
|
||||
ch4InputLabel->setStyleSheet("color: #C0C000; font: 7pt;");
|
||||
ch4Button = new QPushButton(verticalGrpBox);
|
||||
ch4Button->setGeometry(15, 150, 40, 18);
|
||||
ch4Button->setText("CH4");
|
||||
chanMenuButton = new QPushButton(verticalGrpBox);
|
||||
chanMenuButton->setGeometry(15, 190, 40, 18);
|
||||
chanMenuButton->setText("Menu");
|
||||
vertOffsetLabel = new QLabel(verticalGrpBox);
|
||||
vertOffsetLabel->setGeometry(80, 30, 40, 18);
|
||||
vertOffsetLabel->setStyleSheet("font: 7pt;");
|
||||
vertOffsetLabel->setText("Position");
|
||||
vertOffsetDial = new QDial(verticalGrpBox);
|
||||
vertOffsetDial->setGeometry(75, 50, 40, 40);
|
||||
vertOffsetDial->setWrapping(true);
|
||||
vertOffsetDial->setNotchesVisible(true);
|
||||
vertOffsetDial->setSingleStep(1);
|
||||
vertOffsetDial->setMaximum(100);
|
||||
vertOffsetDial->setMinimum(0);
|
||||
vertOffsetDial->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
vertScaleLabel = new QLabel(verticalGrpBox);
|
||||
vertScaleLabel->setGeometry(80, 103, 40, 18);
|
||||
vertScaleLabel->setStyleSheet("font: 7pt;");
|
||||
vertScaleLabel->setText("Scale");
|
||||
vertScaleDial = new QDial(verticalGrpBox);
|
||||
vertScaleDial->setGeometry(70, 120, 50, 50);
|
||||
vertScaleDial->setWrapping(true);
|
||||
vertScaleDial->setNotchesVisible(true);
|
||||
vertScaleDial->setSingleStep(1);
|
||||
vertScaleDial->setMaximum(100);
|
||||
vertScaleDial->setMinimum(0);
|
||||
vertScaleDial->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
|
||||
triggerGrpBox = new QGroupBox("Trigger", DPRwidget);
|
||||
triggerGrpBox->setGeometry(155, 290, 100, 255);
|
||||
|
||||
trigModeLabel = new QLabel(triggerGrpBox);
|
||||
trigModeLabel->setGeometry(10, 20, 100, 18);
|
||||
trigModeLabel->setText("Auto Normal Single");
|
||||
trigModeLabel->setStyleSheet("font: 7pt;");
|
||||
trigModeAutoLed = new TLed(triggerGrpBox);
|
||||
trigModeAutoLed->setGeometry(20, 45, 10, 10);
|
||||
trigModeAutoLed->setOnColor(Qt::yellow);
|
||||
trigModeAutoLed->setOffColor(Qt::lightGray);
|
||||
trigModeNormLed = new TLed(triggerGrpBox);
|
||||
trigModeNormLed->setGeometry(45, 45, 10, 10);
|
||||
trigModeNormLed->setOnColor(Qt::yellow);
|
||||
trigModeNormLed->setOffColor(Qt::lightGray);
|
||||
trigModeSingLed = new TLed(triggerGrpBox);
|
||||
trigModeSingLed->setGeometry(70, 45, 10, 10);
|
||||
trigModeSingLed->setOnColor(Qt::yellow);
|
||||
trigModeSingLed->setOffColor(Qt::lightGray);
|
||||
trigModeButton = new QPushButton(triggerGrpBox);
|
||||
trigModeButton->setGeometry(30, 65, 40, 18);
|
||||
trigModeButton->setText("Mode");
|
||||
trigLevelLabel = new QLabel(triggerGrpBox);
|
||||
trigLevelLabel->setGeometry(34, 92, 40, 18);
|
||||
trigLevelLabel->setText("Level");
|
||||
trigAdjustDial = new QDial(triggerGrpBox);
|
||||
trigAdjustDial->setGeometry(30, 110, 40, 40);
|
||||
trigAdjustDial->setWrapping(true);
|
||||
trigAdjustDial->setNotchesVisible(true);
|
||||
trigAdjustDial->setSingleStep(1);
|
||||
trigAdjustDial->setMaximum(100);
|
||||
trigAdjustDial->setMinimum(0);
|
||||
trigAdjustDial->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
trigMenuButton = new QPushButton(triggerGrpBox);
|
||||
trigMenuButton->setGeometry(30, 160, 40, 18);
|
||||
trigMenuButton->setText("Menu");
|
||||
trigForceButton = new QPushButton(triggerGrpBox);
|
||||
trigForceButton->setGeometry(30, 190, 40, 18);
|
||||
trigForceButton->setText("Force");
|
||||
trig50pctButton = new QPushButton(triggerGrpBox);
|
||||
trig50pctButton->setGeometry(30, 220, 40, 18);
|
||||
trig50pctButton->setText("50\%");
|
||||
|
||||
dockPanelRight = new QDockWidget(this);
|
||||
dockPanelRight->setFeatures(QDockWidget::DockWidgetFloatable);
|
||||
dockPanelRight->setAllowedAreas(Qt::RightDockWidgetArea);
|
||||
dockPanelRight->setWidget(DPRwidget);
|
||||
dockPanelRight->setMinimumWidth(350);
|
||||
dockPanelRight->setMinimumHeight(400);
|
||||
addDockWidget(Qt::RightDockWidgetArea, dockPanelRight);
|
||||
|
||||
DPRwidget->setEnabled(false);
|
||||
|
||||
recent_dir[0] = 0;
|
||||
|
||||
recent_savedir[0] = 0;
|
||||
|
||||
device = NULL;
|
||||
|
||||
QSettings settings;
|
||||
|
||||
strcpy(recent_savedir, settings.value("path/savedir").toString().toLocal8Bit().data());
|
||||
|
||||
adjDialFunc = ADJ_DIAL_FUNC_NONE;
|
||||
navDialFunc = NAV_DIAL_FUNC_NONE;
|
||||
|
||||
scrn_timer = new QTimer(this);
|
||||
stat_timer = new QTimer(this);
|
||||
adjdial_timer = new QTimer(this);
|
||||
navDial_timer = new QTimer(this);
|
||||
navDial_timer->setSingleShot(true);
|
||||
test_timer = new QTimer(this);
|
||||
|
||||
connect(scrn_timer, SIGNAL(timeout()), this, SLOT(scrn_timer_handler()));
|
||||
connect(stat_timer, SIGNAL(timeout()), this, SLOT(stat_timer_handler()));
|
||||
connect(adjdial_timer, SIGNAL(timeout()), this, SLOT(adjdial_timer_handler()));
|
||||
connect(navDial, SIGNAL(sliderReleased()), this, SLOT(navDialReleased()));
|
||||
connect(navDial_timer, SIGNAL(timeout()), this, SLOT(navDial_timer_handler()));
|
||||
connect(test_timer, SIGNAL(timeout()), this, SLOT(test_timer_handler()));
|
||||
|
||||
///// TEST /////////////////////////////////////
|
||||
// DPRwidget->setEnabled(true);
|
||||
//
|
||||
// connect(adjDial, SIGNAL(valueChanged(int)), this, SLOT(adjDialChanged(int)));
|
||||
// connect(trigAdjustDial, SIGNAL(valueChanged(int)), this, SLOT(trigAdjustDialChanged(int)));
|
||||
// connect(horScaleDial, SIGNAL(valueChanged(int)), this, SLOT(horScaleDialChanged(int)));
|
||||
// connect(horPosDial, SIGNAL(valueChanged(int)), this, SLOT(horPosDialChanged(int)));
|
||||
// connect(vertOffsetDial, SIGNAL(valueChanged(int)), this, SLOT(vertOffsetDialChanged(int)));
|
||||
// connect(vertScaleDial, SIGNAL(valueChanged(int)), this, SLOT(vertScaleDialChanged(int)));
|
||||
// connect(navDial, SIGNAL(valueChanged(int)), this, SLOT(navDialChanged(int)));
|
||||
//
|
||||
// connect(ch1Button, SIGNAL(clicked()), this, SLOT(ch1ButtonClicked()));
|
||||
// connect(ch2Button, SIGNAL(clicked()), this, SLOT(ch2ButtonClicked()));
|
||||
// connect(ch3Button, SIGNAL(clicked()), this, SLOT(ch3ButtonClicked()));
|
||||
// connect(ch4Button, SIGNAL(clicked()), this, SLOT(ch4ButtonClicked()));
|
||||
// connect(clearButton, SIGNAL(clicked()), this, SLOT(clearButtonClicked()));
|
||||
// connect(autoButton, SIGNAL(clicked()), this, SLOT(autoButtonClicked()));
|
||||
// connect(runButton, SIGNAL(clicked()), this, SLOT(runButtonClicked()));
|
||||
// connect(singleButton, SIGNAL(clicked()), this, SLOT(singleButtonClicked()));
|
||||
// connect(horMenuButton, SIGNAL(clicked()), this, SLOT(horMenuButtonClicked()));
|
||||
// connect(trigModeButton, SIGNAL(clicked()), this, SLOT(trigModeButtonClicked()));
|
||||
// connect(trigMenuButton, SIGNAL(clicked()), this, SLOT(trigMenuButtonClicked()));
|
||||
// connect(trigForceButton, SIGNAL(clicked()), this, SLOT(trigForceButtonClicked()));
|
||||
// connect(trig50pctButton, SIGNAL(clicked()), this, SLOT(trig50pctButtonClicked()));
|
||||
// connect(acqButton, SIGNAL(clicked()), this, SLOT(acqButtonClicked()));
|
||||
// connect(cursButton, SIGNAL(clicked()), this, SLOT(cursButtonClicked()));
|
||||
// connect(saveButton, SIGNAL(clicked()), this, SLOT(saveButtonClicked()));
|
||||
// connect(dispButton, SIGNAL(clicked()), this, SLOT(dispButtonClicked()));
|
||||
// connect(utilButton, SIGNAL(clicked()), this, SLOT(utilButtonClicked()));
|
||||
// connect(helpButton, SIGNAL(clicked()), this, SLOT(helpButtonClicked()));
|
||||
//
|
||||
// connect(horPosDial, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(horPosDialClicked(QPoint)));
|
||||
// connect(vertOffsetDial, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(vertOffsetDialClicked(QPoint)));
|
||||
// connect(horScaleDial, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(horScaleDialClicked(QPoint)));
|
||||
// connect(vertScaleDial, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(vertScaleDialClicked(QPoint)));
|
||||
// connect(trigAdjustDial, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(trigAdjustDialClicked(QPoint)));
|
||||
// connect(adjDial, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(adjustDialClicked(QPoint)));
|
||||
///// TEST /////////////////////////////////////
|
||||
|
||||
|
||||
show();
|
||||
}
|
||||
|
||||
|
||||
UI_Mainwindow::~UI_Mainwindow()
|
||||
{
|
||||
QSettings settings;
|
||||
|
||||
settings.setValue("path/savedir", recent_savedir);
|
||||
|
||||
delete appfont;
|
||||
delete monofont;
|
||||
|
||||
free(devparms.screenshot_buf);
|
||||
|
||||
for(int i=0; i<MAX_CHNS; i++)
|
||||
{
|
||||
free(devparms.wavebuf[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -52,6 +52,9 @@ What's implemented so far:
|
|||
- trigger force
|
||||
|
||||
|
||||
- measure hardware frequency counter
|
||||
|
||||
|
||||
- display clear
|
||||
- display grid
|
||||
- display grading
|
||||
|
|
263
save_data.cpp
263
save_data.cpp
|
@ -143,7 +143,227 @@ OUT_ERROR:
|
|||
}
|
||||
|
||||
|
||||
void UI_Mainwindow::save_waveform()
|
||||
void UI_Mainwindow::save_memory_waveform()
|
||||
{
|
||||
// int i, j, k, ready, n=0, chns=0, hdl=-1, yoffset[MAX_CHNS], bytes_rcvd;
|
||||
//
|
||||
// char str[128],
|
||||
// opath[MAX_PATHLEN];
|
||||
//
|
||||
// short *wavbuf[4];
|
||||
//
|
||||
// double rec_len = 0;
|
||||
//
|
||||
// // struct waveform_preamble wfp;
|
||||
//
|
||||
// if(device == NULL)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// wavbuf[0] = NULL;
|
||||
// wavbuf[1] = NULL;
|
||||
// wavbuf[2] = NULL;
|
||||
// wavbuf[3] = NULL;
|
||||
//
|
||||
// rec_len = devparms.memdepth / devparms.samplerate;
|
||||
//
|
||||
// if(rec_len < 1e-6)
|
||||
// {
|
||||
// strcpy(str, "Can not save waveforms shorter than 1 uSec.");
|
||||
// goto OUT_ERROR;
|
||||
// }
|
||||
//
|
||||
// for(i=0; i<MAX_CHNS; i++)
|
||||
// {
|
||||
// if(!devparms.chandisplay[i]) // Download data only when channel is switched on
|
||||
// {
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// wavbuf[i] = (short *)malloc(devparms.memdepth * sizeof(short));
|
||||
// if(wavbuf[i] == NULL)
|
||||
// {
|
||||
// strcpy(str, "Malloc error.");
|
||||
// goto OUT_ERROR;
|
||||
// }
|
||||
//
|
||||
// chns++;
|
||||
// }
|
||||
//
|
||||
// if(!chns)
|
||||
// {
|
||||
// strcpy(str, "No active channels.");
|
||||
// goto OUT_ERROR;
|
||||
// }
|
||||
//
|
||||
// scrn_timer->stop();
|
||||
//
|
||||
// stat_timer->stop();
|
||||
//
|
||||
// tmcdev_write(device, ":STOP");
|
||||
//
|
||||
// tmcdev_write(device, ":WAV:POIN?");
|
||||
//
|
||||
// n = tmcdev_read(device);
|
||||
//
|
||||
// printf("n is: %i points response is: ->%s<-\n", n, device->buf);
|
||||
//
|
||||
// for(i=0; i<MAX_CHNS; i++)
|
||||
// {
|
||||
// if(!devparms.chandisplay[i]) // Download data only when channel is switched on
|
||||
// {
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// sprintf(str, ":WAV:SOUR CHAN%i", i + 1);
|
||||
//
|
||||
// tmcdev_write(device, str);
|
||||
//
|
||||
// tmcdev_write(device, ":WAV:FORM BYTE");
|
||||
//
|
||||
// tmcdev_write(device, ":WAV:MODE RAW");
|
||||
//
|
||||
// tmcdev_write(device, ":WAV:POIN?");
|
||||
//
|
||||
// n = tmcdev_read(device);
|
||||
//
|
||||
// printf("n is: %i points response is: ->%s<-\n", n, device->buf);
|
||||
//
|
||||
// tmcdev_write(device, ":WAV RES");
|
||||
//
|
||||
// tmcdev_write(device, ":WAV BEG");
|
||||
//
|
||||
// bytes_rcvd = 0;
|
||||
//
|
||||
// ready = 0;
|
||||
//
|
||||
// while(1)
|
||||
// {
|
||||
// tmcdev_write(device, ":WAV:STAT?");
|
||||
//
|
||||
// n = tmcdev_read(device);
|
||||
//
|
||||
// printf("n is: %i response is: ->%s<-\n", n, device->buf);
|
||||
//
|
||||
// if(n < 4)
|
||||
// {
|
||||
// strcpy(str, "Error, could not read waveform status.");
|
||||
// goto OUT_ERROR;
|
||||
// }
|
||||
//
|
||||
// if(strncmp(device->buf, "READ", 4))
|
||||
// {
|
||||
// ready = 1;
|
||||
// }
|
||||
//
|
||||
// tmcdev_write(device, ":WAV:DATA?");
|
||||
//
|
||||
// QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
//
|
||||
// n = tmcdev_read(device);
|
||||
//
|
||||
// QApplication::restoreOverrideCursor();
|
||||
//
|
||||
// if(n < 0)
|
||||
// {
|
||||
// strcpy(str, "Can not read from device.\n"
|
||||
// "Have you already patched the usbtmc driver?");
|
||||
// goto OUT_ERROR;
|
||||
// }
|
||||
//
|
||||
// printf("received %i bytes\n", n);
|
||||
//
|
||||
// if(n > devparms.memdepth)
|
||||
// {
|
||||
// strcpy(str, "Datablock too big for buffer.");
|
||||
// goto OUT_ERROR;
|
||||
// }
|
||||
//
|
||||
// if(ready)
|
||||
// {
|
||||
// tmcdev_write(device, ":WAV END");
|
||||
//
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// for(i=0; i<MAX_CHNS; i++)
|
||||
// {
|
||||
// free(wavbuf[i]);
|
||||
// }
|
||||
//
|
||||
// stat_timer->start(STAT_TIMER_IVAL);
|
||||
//
|
||||
// scrn_timer->start(SCRN_TIMER_IVAL);
|
||||
//
|
||||
// return;
|
||||
//
|
||||
// OUT_ERROR:
|
||||
//
|
||||
// QMessageBox msgBox;
|
||||
// msgBox.setIcon(QMessageBox::Critical);
|
||||
// msgBox.setText(str);
|
||||
// msgBox.exec();
|
||||
//
|
||||
// if(hdl >= 0)
|
||||
// {
|
||||
// edfclose_file(hdl);
|
||||
// }
|
||||
//
|
||||
// for(i=0; i<MAX_CHNS; i++)
|
||||
// {
|
||||
// free(wavbuf[i]);
|
||||
// }
|
||||
//
|
||||
// stat_timer->start(STAT_TIMER_IVAL);
|
||||
//
|
||||
// scrn_timer->start(SCRN_TIMER_IVAL);
|
||||
}
|
||||
|
||||
|
||||
// tmcdev_write(device, ":WAV:PRE?");
|
||||
//
|
||||
// n = tmcdev_read(device);
|
||||
//
|
||||
// if(n < 0)
|
||||
// {
|
||||
// strcpy(str, "Can not read from device.");
|
||||
// goto OUT_ERROR;
|
||||
// }
|
||||
|
||||
// printf("waveform preamble: %s\n", device->buf);
|
||||
|
||||
// if(parse_preamble(device->buf, device->sz, &wfp, i))
|
||||
// {
|
||||
// strcpy(str, "Preamble parsing error.");
|
||||
// goto OUT_ERROR;
|
||||
// }
|
||||
|
||||
// printf("waveform preamble:\n"
|
||||
// "format: %i\n"
|
||||
// "type: %i\n"
|
||||
// "points: %i\n"
|
||||
// "count: %i\n"
|
||||
// "xincrement: %e\n"
|
||||
// "xorigin: %e\n"
|
||||
// "xreference: %e\n"
|
||||
// "yincrement: %e\n"
|
||||
// "yorigin: %e\n"
|
||||
// "yreference: %e\n",
|
||||
// wfp.format, wfp.type, wfp.points, wfp.count,
|
||||
// wfp.xincrement[i], wfp.xorigin[i], wfp.xreference[i],
|
||||
// wfp.yincrement[i], wfp.yorigin[i], wfp.yreference[i]);
|
||||
|
||||
// rec_len = wfp.xincrement[i] * wfp.points;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void UI_Mainwindow::save_screen_waveform()
|
||||
{
|
||||
int i, j, n=0, chns=0, hdl=-1, yoffset[MAX_CHNS];
|
||||
|
||||
|
@ -154,8 +374,6 @@ void UI_Mainwindow::save_waveform()
|
|||
|
||||
double rec_len = 0;
|
||||
|
||||
// struct waveform_preamble wfp;
|
||||
|
||||
if(device == NULL)
|
||||
{
|
||||
return;
|
||||
|
@ -197,10 +415,6 @@ void UI_Mainwindow::save_waveform()
|
|||
goto OUT_ERROR;
|
||||
}
|
||||
|
||||
// tmcdev_write(device, ":ACQ:SRAT?");
|
||||
//
|
||||
// devparms.samplerate = atof(device->buf);
|
||||
|
||||
for(i=0; i<MAX_CHNS; i++)
|
||||
{
|
||||
if(!devparms.chandisplay[i]) // Download data only when channel is switched on
|
||||
|
@ -216,41 +430,6 @@ void UI_Mainwindow::save_waveform()
|
|||
|
||||
tmcdev_write(device, ":WAV:MODE NORM");
|
||||
|
||||
// tmcdev_write(device, ":WAV:PRE?");
|
||||
//
|
||||
// n = tmcdev_read(device);
|
||||
//
|
||||
// if(n < 0)
|
||||
// {
|
||||
// strcpy(str, "Can not read from device.");
|
||||
// goto OUT_ERROR;
|
||||
// }
|
||||
|
||||
// printf("waveform preamble: %s\n", device->buf);
|
||||
|
||||
// if(parse_preamble(device->buf, device->sz, &wfp, i))
|
||||
// {
|
||||
// strcpy(str, "Preamble parsing error.");
|
||||
// goto OUT_ERROR;
|
||||
// }
|
||||
|
||||
// printf("waveform preamble:\n"
|
||||
// "format: %i\n"
|
||||
// "type: %i\n"
|
||||
// "points: %i\n"
|
||||
// "count: %i\n"
|
||||
// "xincrement: %e\n"
|
||||
// "xorigin: %e\n"
|
||||
// "xreference: %e\n"
|
||||
// "yincrement: %e\n"
|
||||
// "yorigin: %e\n"
|
||||
// "yreference: %e\n",
|
||||
// wfp.format, wfp.type, wfp.points, wfp.count,
|
||||
// wfp.xincrement[i], wfp.xorigin[i], wfp.xreference[i],
|
||||
// wfp.yincrement[i], wfp.yorigin[i], wfp.yreference[i]);
|
||||
|
||||
// rec_len = wfp.xincrement[i] * wfp.points;
|
||||
|
||||
tmcdev_write(device, ":WAV:DATA?");
|
||||
|
||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
|
|
104
signalcurve.cpp
104
signalcurve.cpp
|
@ -134,7 +134,7 @@ void SignalCurve::paintEvent(QPaintEvent *)
|
|||
|
||||
void SignalCurve::drawWidget(QPainter *painter, int curve_w, int curve_h)
|
||||
{
|
||||
int i, chn, tmp;
|
||||
int i, chn, tmp, rot=1;
|
||||
|
||||
double offset=0.0,
|
||||
h_step=0.0,
|
||||
|
@ -158,14 +158,25 @@ void SignalCurve::drawWidget(QPainter *painter, int curve_w, int curve_h)
|
|||
|
||||
if(tmp < 291)
|
||||
{
|
||||
tmp = 291;
|
||||
tmp = 286;
|
||||
|
||||
rot = 2;
|
||||
}
|
||||
else if(tmp > 523)
|
||||
{
|
||||
tmp = 523;
|
||||
tmp = 528;
|
||||
|
||||
rot = 0;
|
||||
}
|
||||
|
||||
drawSmallTriggerArrow(painter, tmp, 16, QColor(255, 128, 0));
|
||||
if((rot == 0) || (rot == 2))
|
||||
{
|
||||
drawSmallTriggerArrow(painter, tmp, 11, rot, QColor(255, 128, 0));
|
||||
}
|
||||
else
|
||||
{
|
||||
drawSmallTriggerArrow(painter, tmp, 16, rot, QColor(255, 128, 0));
|
||||
}
|
||||
|
||||
painter->fillRect(0, curve_h - 30, curve_w, curve_h, QColor(32, 32, 32));
|
||||
|
||||
|
@ -433,31 +444,40 @@ void SignalCurve::drawWidget(QPainter *painter, int curve_w, int curve_h)
|
|||
|
||||
QPainterPath path;
|
||||
|
||||
path.addRoundedRect(600, 20, 122, 20, 3, 3);
|
||||
path.addRoundedRect(600, 6, 122, 20, 3, 3);
|
||||
|
||||
painter->fillPath(path, Qt::black);
|
||||
|
||||
painter->setPen(Qt::darkGray);
|
||||
|
||||
painter->drawRoundedRect(600, 20, 122, 20, 3, 3);
|
||||
painter->drawRoundedRect(600, 6, 122, 20, 3, 3);
|
||||
|
||||
path = QPainterPath();
|
||||
|
||||
path.addRoundedRect(604, 23, 14, 14, 3, 3);
|
||||
path.addRoundedRect(604, 9, 14, 14, 3, 3);
|
||||
|
||||
painter->fillPath(path, SignalColor[devparms->countersrc - 1]);
|
||||
|
||||
painter->setPen(Qt::black);
|
||||
|
||||
painter->drawLine(607, 26, 615, 26);
|
||||
painter->drawLine(607, 12, 615, 12);
|
||||
|
||||
painter->drawLine(611, 26, 611, 34);
|
||||
painter->drawLine(611, 12, 611, 20);
|
||||
|
||||
painter->setPen(Qt::white);
|
||||
|
||||
sprintf(str, "%.3f Hz", devparms->counterfreq);
|
||||
if((devparms->counterfreq < 15) || (devparms->counterfreq > 1.1e9))
|
||||
{
|
||||
strcpy(str, "< 15 Hz");
|
||||
}
|
||||
else
|
||||
{
|
||||
convert_to_metric_suffix(str, devparms->counterfreq, 4);
|
||||
|
||||
painter->drawText(622, 20, 100, 20, Qt::AlignCenter, str);
|
||||
strcat(str, "Hz");
|
||||
}
|
||||
|
||||
painter->drawText(622, 6, 100, 20, Qt::AlignCenter, str);
|
||||
}
|
||||
|
||||
// clk_end = clock();
|
||||
|
@ -644,7 +664,7 @@ void SignalCurve::drawTopLabels(QPainter *painter)
|
|||
|
||||
painter->drawText(555, 20, "D");
|
||||
|
||||
convert_to_metric_suffix(str, devparms->timebaseoffset, 3);
|
||||
convert_to_metric_suffix(str, devparms->timebaseoffset, 4);
|
||||
|
||||
strcat(str, "s");
|
||||
|
||||
|
@ -984,23 +1004,61 @@ void SignalCurve::drawArrow(QPainter *painter, int xpos, int ypos, int rot, QCol
|
|||
}
|
||||
|
||||
|
||||
void SignalCurve::drawSmallTriggerArrow(QPainter *painter, int xpos, int ypos, QColor color)
|
||||
void SignalCurve::drawSmallTriggerArrow(QPainter *painter, int xpos, int ypos, int rot, QColor color)
|
||||
{
|
||||
QPainterPath path;
|
||||
|
||||
path.moveTo(xpos + 5, ypos - 10);
|
||||
path.lineTo(xpos + 5, ypos - 5);
|
||||
path.lineTo(xpos, ypos);
|
||||
path.lineTo(xpos - 4, ypos - 5);
|
||||
path.lineTo(xpos - 4, ypos - 10);
|
||||
path.lineTo(xpos + 5, ypos - 10);
|
||||
painter->fillPath(path, color);
|
||||
if(rot == 0)
|
||||
{
|
||||
path.moveTo(xpos - 13, ypos - 5);
|
||||
path.lineTo(xpos - 5, ypos - 5);
|
||||
path.lineTo(xpos, ypos);
|
||||
path.lineTo(xpos - 5, ypos + 5);
|
||||
path.lineTo(xpos - 13, ypos + 5);
|
||||
path.lineTo(xpos - 13, ypos - 5);
|
||||
|
||||
painter->setPen(Qt::black);
|
||||
painter->fillPath(path, color);
|
||||
|
||||
painter->drawLine(xpos - 2, ypos - 8, xpos + 2, ypos - 8);
|
||||
painter->setPen(Qt::black);
|
||||
|
||||
painter->drawLine(xpos, ypos - 8, xpos, ypos - 3);
|
||||
painter->drawLine(xpos - 10, ypos - 4, xpos - 6, ypos - 4);
|
||||
|
||||
painter->drawLine(xpos - 8, ypos - 4, xpos - 8, ypos + 4);
|
||||
}
|
||||
else if(rot == 1)
|
||||
{
|
||||
path.moveTo(xpos + 5, ypos - 10);
|
||||
path.lineTo(xpos + 5, ypos - 5);
|
||||
path.lineTo(xpos, ypos);
|
||||
path.lineTo(xpos - 4, ypos - 5);
|
||||
path.lineTo(xpos - 4, ypos - 10);
|
||||
path.lineTo(xpos + 5, ypos - 10);
|
||||
|
||||
painter->fillPath(path, color);
|
||||
|
||||
painter->setPen(Qt::black);
|
||||
|
||||
painter->drawLine(xpos - 2, ypos - 8, xpos + 2, ypos - 8);
|
||||
|
||||
painter->drawLine(xpos, ypos - 8, xpos, ypos - 3);
|
||||
}
|
||||
else if(rot == 2)
|
||||
{
|
||||
path.moveTo(xpos + 12, ypos - 5);
|
||||
path.lineTo(xpos + 5, ypos - 5);
|
||||
path.lineTo(xpos, ypos);
|
||||
path.lineTo(xpos + 5, ypos + 5);
|
||||
path.lineTo(xpos + 12, ypos + 5);
|
||||
path.lineTo(xpos + 12, ypos - 5);
|
||||
|
||||
painter->fillPath(path, color);
|
||||
|
||||
painter->setPen(Qt::black);
|
||||
|
||||
painter->drawLine(xpos + 9, ypos - 4, xpos + 5, ypos - 4);
|
||||
|
||||
painter->drawLine(xpos + 7, ypos - 4, xpos + 7, ypos + 4);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -138,7 +138,7 @@ private:
|
|||
|
||||
void drawWidget(QPainter *, int, int);
|
||||
void drawArrow(QPainter *, int, int, int, QColor, char);
|
||||
void drawSmallTriggerArrow(QPainter *, int, int, QColor);
|
||||
void drawSmallTriggerArrow(QPainter *, int, int, int, QColor);
|
||||
void drawTrigCenterArrow(QPainter *, int, int);
|
||||
void drawChanLabel(QPainter *, int, int, int);
|
||||
void drawTopLabels(QPainter *);
|
||||
|
|
|
@ -133,7 +133,8 @@ int tmcdev_write(struct tmcdev *dev, const char *cmd)
|
|||
!strncmp(buf, ":WAV:SOUR CHAN", 14) ||
|
||||
!strncmp(buf, ":TRIG:SWE?", 10) ||
|
||||
!strncmp(buf, ":ACQ:SRAT?", 10) ||
|
||||
!strncmp(buf, ":ACQ:MDEP?", 10)))
|
||||
!strncmp(buf, ":ACQ:MDEP?", 10) ||
|
||||
!strncmp(buf, ":MEAS:COUN:VAL?", 15)))
|
||||
{
|
||||
printf("tmc_dev write: %s", buf);
|
||||
}
|
||||
|
|
8
utils.c
8
utils.c
|
@ -1673,6 +1673,14 @@ int convert_to_metric_suffix(char *buf, double value, int decimals)
|
|||
break;
|
||||
case 2: return sprintf(buf, "%.2f%c", ltmp, suffix);
|
||||
break;
|
||||
case 3: return sprintf(buf, "%.3f%c", ltmp, suffix);
|
||||
break;
|
||||
case 4: return sprintf(buf, "%.4f%c", ltmp, suffix);
|
||||
break;
|
||||
case 5: return sprintf(buf, "%.5f%c", ltmp, suffix);
|
||||
break;
|
||||
case 6: return sprintf(buf, "%.6f%c", ltmp, suffix);
|
||||
break;
|
||||
default: return sprintf(buf, "%.3f%c", ltmp, suffix);
|
||||
break;
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue