Work in progress.

merge-requests/1/head
Teuniz 2015-06-05 17:43:27 +02:00
rodzic 9a08caa944
commit 99ac1a5d51
8 zmienionych plików z 431 dodań i 159 usunięć

Wyświetl plik

@ -41,7 +41,7 @@
#define SCRN_TIMER_IVAL 50
#define ADJDIAL_TIMER_IVAL 200
#define ADJDIAL_TIMER_IVAL 3000
#define SCRN_SHOT_BMP_SZ 1152054
@ -49,7 +49,7 @@
#define ADJ_DIAL_FUNC_NONE 0
#define ADJ_DIAL_FUNC_HOLDOFF 1
#define ADJ_DIAL_CNT_TIMEOUT 30
#define ADJ_DIAL_FUNC_ACQ_AVG 2
#define NAV_DIAL_FUNC_NONE 0
#define NAV_DIAL_FUNC_HOLDOFF 1
@ -120,6 +120,10 @@ struct device_settings
int triggersweep; // 0=auto, 1=normal, 2=single
int displaygrid; // 0=none, 1=half, 2=full
int displaytype; // 0=vectors, 1=dots
int acquiretype; // 0=normal, 1=average, 2=peak, 3=highres
int acquireaverages; // 2, 4, 8, 16, 32, 64, etc. to 8192
int countersrc; // 0=off, 1=ch1, 2=ch2, 3=ch3, 4=ch4
double counterfreq; // Value of frequency counter

Wyświetl plik

@ -106,45 +106,10 @@ void UI_Mainwindow::navDialChanged(int npos)
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)
{
adjdial_timer->start(ADJDIAL_TIMER_IVAL);
val = get_stepsize_divide_by_1000(devparms.triggerholdoff);
devparms.triggerholdoff += (val * mpr);
@ -159,7 +124,7 @@ void UI_Mainwindow::navDialChanged(int npos)
devparms.triggerholdoff = 10;
}
strcpy(str, "Holdoff: ");
strcpy(str, "Trigger holdoff: ");
convert_to_metric_suffix(str + strlen(str), devparms.triggerholdoff, 2);
@ -171,6 +136,40 @@ void UI_Mainwindow::navDialChanged(int npos)
tmcdev_write(device, str);
}
else 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);
}
}
@ -182,6 +181,53 @@ void UI_Mainwindow::navDialReleased()
void UI_Mainwindow::acqButtonClicked()
{
QMenu menu,
submenuacquisition;
submenuacquisition.setTitle("Acquisition");
submenuacquisition.addAction("Normal", this, SLOT(set_acq_normal()));
submenuacquisition.addAction("Average", this, SLOT(set_acq_average()));
menu.addMenu(&submenuacquisition);
menu.exec(acqButton->mapToGlobal(QPoint(0,0)));
}
void UI_Mainwindow::set_acq_normal()
{
if(devparms.acquiretype == 0)
{
return;
}
devparms.acquiretype = 0;
statusLabel->setText("Acquire: normal");
tmcdev_write(device, ":ACQ:TYPE NORM");
}
void UI_Mainwindow::set_acq_average()
{
adjDialFunc = ADJ_DIAL_FUNC_ACQ_AVG;
adjDialLabel->setText("Averages");
adjDialLabel->setStyleSheet("background: #66FF99; font: 7pt;");
adjdial_timer->start(ADJDIAL_TIMER_IVAL);
if(devparms.acquiretype == 1)
{
return;
}
devparms.acquiretype = 1;
statusLabel->setText("Acquire: average");
tmcdev_write(device, ":ACQ:TYPE AVER");
}
@ -205,9 +251,15 @@ void UI_Mainwindow::saveButtonClicked()
void UI_Mainwindow::dispButtonClicked()
{
QMenu menu,
submenutype,
submenugrid,
submenugrading;
submenutype.setTitle("Type");
submenutype.addAction("Vectors", this, SLOT(set_grid_type_vectors()));
submenutype.addAction("Dots", this, SLOT(set_grid_type_dots()));
menu.addMenu(&submenutype);
submenugrid.setTitle("Grid");
submenugrid.addAction("Full", this, SLOT(set_grid_full()));
submenugrid.addAction("Half", this, SLOT(set_grid_half()));
@ -232,8 +284,43 @@ void UI_Mainwindow::dispButtonClicked()
}
void UI_Mainwindow::set_grid_type_vectors()
{
if(!devparms.displaytype)
{
return;
}
devparms.displaytype = 0;
statusLabel->setText("Display type: vectors");
tmcdev_write(device, ":DISP:TYPE VECT");
}
void UI_Mainwindow::set_grid_type_dots()
{
if(devparms.displaytype)
{
return;
}
devparms.displaytype = 1;
statusLabel->setText("Display type: dotss");
tmcdev_write(device, ":DISP:TYPE DOTS");
}
void UI_Mainwindow::set_grid_full()
{
if(devparms.displaygrid == 2)
{
return;
}
devparms.displaygrid = 2;
statusLabel->setText("Display grid: full");
@ -244,6 +331,11 @@ void UI_Mainwindow::set_grid_full()
void UI_Mainwindow::set_grid_half()
{
if(devparms.displaygrid == 1)
{
return;
}
devparms.displaygrid = 1;
statusLabel->setText("Display grid: half");
@ -254,6 +346,11 @@ void UI_Mainwindow::set_grid_half()
void UI_Mainwindow::set_grid_none()
{
if(devparms.displaygrid == 0)
{
return;
}
devparms.displaygrid = 0;
statusLabel->setText("Display grid: none");
@ -374,12 +471,6 @@ void UI_Mainwindow::adjDialChanged(int new_pos)
char str[512];
adjdial_timer->stop();
adjDialLabel->setStyleSheet(def_stylesh);
adjDialLabel->setStyleSheet("font: 7pt;");
if(adjDialFunc == ADJ_DIAL_FUNC_NONE)
{
return;
@ -422,6 +513,8 @@ void UI_Mainwindow::adjDialChanged(int new_pos)
if(adjDialFunc == ADJ_DIAL_FUNC_HOLDOFF)
{
adjdial_timer->start(ADJDIAL_TIMER_IVAL);
if(!dir)
{
if(devparms.triggerholdoff >= 10)
@ -449,7 +542,7 @@ void UI_Mainwindow::adjDialChanged(int new_pos)
devparms.triggerholdoff -= get_stepsize_divide_by_1000(devparms.triggerholdoff);
}
strcpy(str, "Holdoff: ");
strcpy(str, "Trigger holdoff: ");
convert_to_metric_suffix(str + strlen(str), devparms.triggerholdoff, 2);
@ -461,6 +554,45 @@ void UI_Mainwindow::adjDialChanged(int new_pos)
tmcdev_write(device, str);
}
else if(adjDialFunc == ADJ_DIAL_FUNC_ACQ_AVG)
{
adjdial_timer->start(ADJDIAL_TIMER_IVAL);
if(!dir)
{
if(devparms.acquireaverages >= 8192)
{
devparms.acquireaverages = 8192;
old_pos = new_pos;
return;
}
devparms.acquireaverages *= 2;
}
else
{
if(devparms.acquireaverages <= 2)
{
devparms.acquireaverages = 2;
old_pos = new_pos;
return;
}
devparms.acquireaverages /= 2;
}
sprintf(str, "Acquire averages: %i", devparms.acquireaverages);
statusLabel->setText(str);
sprintf(str, ":ACQ:AVER %i", devparms.acquireaverages);
tmcdev_write(device, str);
}
old_pos = new_pos;
}
@ -1145,6 +1277,8 @@ void UI_Mainwindow::ch1ButtonClicked()
{
devparms.chandisplay[0] = 0;
statusLabel->setText("Channel 1 off");
tmcdev_write(device, ":CHAN1:DISP 0");
ch1Button->setStyleSheet(def_stylesh);
@ -1170,6 +1304,8 @@ void UI_Mainwindow::ch1ButtonClicked()
{
devparms.chandisplay[0] = 1;
statusLabel->setText("Channel 1 on");
tmcdev_write(device, ":CHAN1:DISP 1");
ch1Button->setStyleSheet("background: #FFFF33;");
@ -1187,6 +1323,8 @@ void UI_Mainwindow::ch2ButtonClicked()
{
devparms.chandisplay[1] = 0;
statusLabel->setText("Channel 2 off");
tmcdev_write(device, ":CHAN2:DISP 0");
ch2Button->setStyleSheet(def_stylesh);
@ -1212,6 +1350,8 @@ void UI_Mainwindow::ch2ButtonClicked()
{
devparms.chandisplay[1] = 1;
statusLabel->setText("Channel 2 on");
tmcdev_write(device, ":CHAN2:DISP 1");
ch2Button->setStyleSheet("background: #33FFFF;");
@ -1229,6 +1369,8 @@ void UI_Mainwindow::ch3ButtonClicked()
{
devparms.chandisplay[2] = 0;
statusLabel->setText("Channel 3 off");
tmcdev_write(device, ":CHAN3:DISP 0");
ch3Button->setStyleSheet(def_stylesh);
@ -1254,6 +1396,8 @@ void UI_Mainwindow::ch3ButtonClicked()
{
devparms.chandisplay[2] = 1;
statusLabel->setText("Channel 3 on");
tmcdev_write(device, ":CHAN3:DISP 1");
ch3Button->setStyleSheet("background: #FF33FF;");
@ -1271,6 +1415,8 @@ void UI_Mainwindow::ch4ButtonClicked()
{
devparms.chandisplay[3] = 0;
statusLabel->setText("Channel 4 off");
tmcdev_write(device, ":CHAN4:DISP 0");
ch4Button->setStyleSheet(def_stylesh);
@ -1296,6 +1442,8 @@ void UI_Mainwindow::ch4ButtonClicked()
{
devparms.chandisplay[3] = 1;
statusLabel->setText("Channel 4 on");
tmcdev_write(device, ":CHAN4:DISP 1");
ch4Button->setStyleSheet("background: #0066CC;");
@ -1512,12 +1660,16 @@ void UI_Mainwindow::vertOffsetDialClicked(QPoint)
void UI_Mainwindow::clearButtonClicked()
{
statusLabel->setText("Display cleared");
tmcdev_write(device, ":DISP:CLE");
}
void UI_Mainwindow::autoButtonClicked()
{
statusLabel->setText("Auto settings");
tmcdev_write(device, ":AUT");
}
@ -1526,10 +1678,14 @@ void UI_Mainwindow::runButtonClicked()
{
if(devparms.triggerstatus == 5)
{
statusLabel->setText("Trigger: run");
tmcdev_write(device, ":RUN");
}
else
{
statusLabel->setText("Trigger: stop");
tmcdev_write(device, ":STOP");
}
}
@ -1537,6 +1693,8 @@ void UI_Mainwindow::runButtonClicked()
void UI_Mainwindow::singleButtonClicked()
{
statusLabel->setText("Trigger: single");
tmcdev_write(device, ":SING");
}
@ -1704,6 +1862,8 @@ void UI_Mainwindow::counter_off()
{
devparms.countersrc = 0;
statusLabel->setText("Freq. counter off");
tmcdev_write(device, ":MEAS:COUN:SOUR OFF");
}
@ -1712,6 +1872,8 @@ void UI_Mainwindow::counter_ch1()
{
devparms.countersrc = 1;
statusLabel->setText("Freq. counter channel 1");
tmcdev_write(device, ":MEAS:COUN:SOUR CHAN1");
}
@ -1720,6 +1882,8 @@ void UI_Mainwindow::counter_ch2()
{
devparms.countersrc = 2;
statusLabel->setText("Freq. counter channel 2");
tmcdev_write(device, ":MEAS:COUN:SOUR CHAN2");
}
@ -1728,6 +1892,8 @@ void UI_Mainwindow::counter_ch3()
{
devparms.countersrc = 3;
statusLabel->setText("Freq. counter channel 3");
tmcdev_write(device, ":MEAS:COUN:SOUR CHAN3");
}
@ -1736,6 +1902,8 @@ void UI_Mainwindow::counter_ch4()
{
devparms.countersrc = 4;
statusLabel->setText("Freq. counter channel 4");
tmcdev_write(device, ":MEAS:COUN:SOUR CHAN4");
}
@ -1750,14 +1918,17 @@ void UI_Mainwindow::trigModeButtonClicked()
{
case 0: trigModeAutoLed->setValue(true);
trigModeSingLed->setValue(false);
statusLabel->setText("Trigger auto");
tmcdev_write(device, ":TRIG:SWE AUTO");
break;
case 1: trigModeNormLed->setValue(true);
trigModeAutoLed->setValue(false);
statusLabel->setText("Trigger norm");
tmcdev_write(device, ":TRIG:SWE NORM");
break;
case 2: trigModeSingLed->setValue(true);
trigModeNormLed->setValue(false);
statusLabel->setText("Trigger single");
tmcdev_write(device, ":TRIG:SWE SING");
break;
}
@ -1816,6 +1987,8 @@ void UI_Mainwindow::trigger_source_ch1()
{
devparms.triggeredgesource = 0;
statusLabel->setText("Trigger source channel 1");
tmcdev_write(device, ":TRIG:EDG:SOUR CHAN1");
}
@ -1824,6 +1997,8 @@ void UI_Mainwindow::trigger_source_ch2()
{
devparms.triggeredgesource = 1;
statusLabel->setText("Trigger source channel 2");
tmcdev_write(device, ":TRIG:EDG:SOUR CHAN2");
}
@ -1832,6 +2007,8 @@ void UI_Mainwindow::trigger_source_ch3()
{
devparms.triggeredgesource = 2;
statusLabel->setText("Trigger source channel 3");
tmcdev_write(device, ":TRIG:EDG:SOUR CHAN3");
}
@ -1840,6 +2017,8 @@ void UI_Mainwindow::trigger_source_ch4()
{
devparms.triggeredgesource = 3;
statusLabel->setText("Trigger source channel 4");
tmcdev_write(device, ":TRIG:EDG:SOUR CHAN4");
}
@ -1848,6 +2027,8 @@ void UI_Mainwindow::trigger_source_ext()
{
devparms.triggeredgesource = 4;
statusLabel->setText("Trigger source extern");
tmcdev_write(device, ":TRIG:EDG:SOUR EXT");
}
@ -1856,6 +2037,8 @@ void UI_Mainwindow::trigger_source_ext5()
{
devparms.triggeredgesource = 5;
statusLabel->setText("Trigger source extern 5");
tmcdev_write(device, ":TRIG:EDG:SOUR EXT5");
}
@ -1864,6 +2047,8 @@ void UI_Mainwindow::trigger_source_acl()
{
devparms.triggeredgesource = 6;
statusLabel->setText("Trigger source AC powerline");
tmcdev_write(device, ":TRIG:EDG:SOUR ACL");
}
@ -1872,6 +2057,8 @@ void UI_Mainwindow::trigger_coupling_ac()
{
devparms.triggercoupling = 0;
statusLabel->setText("Trigger coupling AC");
tmcdev_write(device, ":TRIG:COUP AC");
}
@ -1880,6 +2067,8 @@ void UI_Mainwindow::trigger_coupling_dc()
{
devparms.triggercoupling = 1;
statusLabel->setText("Trigger coupling DC");
tmcdev_write(device, ":TRIG:COUP DC");
}
@ -1888,6 +2077,8 @@ void UI_Mainwindow::trigger_coupling_lfreject()
{
devparms.triggercoupling = 2;
statusLabel->setText("Trigger LF reject");
tmcdev_write(device, ":TRIG:COUP LFR");
}
@ -1896,6 +2087,8 @@ void UI_Mainwindow::trigger_coupling_hfreject()
{
devparms.triggercoupling = 3;
statusLabel->setText("Trigger HF reject");
tmcdev_write(device, ":TRIG:COUP HFR");
}
@ -1904,6 +2097,8 @@ void UI_Mainwindow::trigger_slope_pos()
{
devparms.triggeredgeslope = 0;
statusLabel->setText("Trigger edge positive");
tmcdev_write(device, ":TRIG:EDG:SLOP POS");
}
@ -1912,6 +2107,8 @@ void UI_Mainwindow::trigger_slope_neg()
{
devparms.triggeredgeslope = 1;
statusLabel->setText("Trigger edge negative");
tmcdev_write(device, ":TRIG:EDG:SLOP NEG");
}
@ -1920,6 +2117,8 @@ void UI_Mainwindow::trigger_slope_rfal()
{
devparms.triggeredgeslope = 2;
statusLabel->setText("Trigger edge positive /negative");
tmcdev_write(device, ":TRIG:EDG:SLOP RFAL");
}
@ -1932,7 +2131,7 @@ void UI_Mainwindow::trigger_setting_holdoff()
adjDialLabel->setText("Holdoff");
adjDialCnt = 0;
adjDialLabel->setStyleSheet("background: #66FF99; font: 7pt;");
adjdial_timer->start(ADJDIAL_TIMER_IVAL);
}
@ -1940,12 +2139,16 @@ void UI_Mainwindow::trigger_setting_holdoff()
void UI_Mainwindow::trigForceButtonClicked()
{
statusLabel->setText("Trigger force");
tmcdev_write(device, ":TFOR");
}
void UI_Mainwindow::trig50pctButtonClicked()
{
statusLabel->setText("Trigger 50%");
tmcdev_write(device, ":TLHA");
tmcdev_write(device, ":TRIG:EDG:LEV?");

Wyświetl plik

@ -1309,6 +1309,80 @@ int UI_Mainwindow::get_device_settings()
goto OUT_ERROR;
}
if(tmcdev_write(device, ":DISP:TYPE?") != 11)
{
line = __LINE__;
goto OUT_ERROR;
}
if(tmcdev_read(device) < 1)
{
line = __LINE__;
goto OUT_ERROR;
}
if(!strcmp(device->buf, "VECT"))
{
devparms.displaytype = 0;
}
else if(!strcmp(device->buf, "DOTS"))
{
devparms.displaytype = 1;
}
else
{
line = __LINE__;
goto OUT_ERROR;
}
if(tmcdev_write(device, ":ACQ:TYPE?") != 10)
{
line = __LINE__;
goto OUT_ERROR;
}
if(tmcdev_read(device) < 1)
{
line = __LINE__;
goto OUT_ERROR;
}
if(!strcmp(device->buf, "NORM"))
{
devparms.acquiretype = 0;
}
else if(!strcmp(device->buf, "AVER"))
{
devparms.acquiretype = 1;
}
else if(!strcmp(device->buf, "PEAK"))
{
devparms.acquiretype = 2;
}
else if(!strcmp(device->buf, "HRESR"))
{
devparms.acquiretype = 3;
}
else
{
line = __LINE__;
goto OUT_ERROR;
}
if(tmcdev_write(device, ":ACQ:AVER?") != 10)
{
line = __LINE__;
goto OUT_ERROR;
}
if(tmcdev_read(device) < 1)
{
line = __LINE__;
goto OUT_ERROR;
}
devparms.acquireaverages = atoi(device->buf);
return 0;
OUT_ERROR:

Wyświetl plik

@ -106,6 +106,9 @@ public:
QFont *appfont,
*monofont;
int adjDialFunc,
navDialFunc;
private:
QMenuBar *menubar;
@ -191,10 +194,6 @@ private:
SignalCurve *waveForm;
int adjDialFunc,
adjDialCnt,
navDialFunc;
int parse_preamble(char *, int, struct waveform_preamble *, int);
int get_metric_factor(double);
void get_device_model(const char *);
@ -281,6 +280,9 @@ private slots:
void navDial_timer_handler();
void navDialChanged(int);
void set_grid_type_vectors();
void set_grid_type_dots();
void set_grid_full();
void set_grid_half();
void set_grid_none();
@ -308,6 +310,9 @@ private slots:
void chan_menu();
void set_acq_normal();
void set_acq_average();
protected:
void closeEvent(QCloseEvent *);

Wyświetl plik

@ -58,6 +58,12 @@ What's implemented so far:
- display clear
- display grid
- display grading
- display vectors
- display dots
- acquire normal
- acquire average
- save screenshot

Wyświetl plik

@ -360,6 +360,11 @@ void SignalCurve::drawWidget(QPainter *painter, int curve_w, int curve_h)
{
if(i < (bufsize - 1))
{
if(devparms->displaytype)
{
painter->drawPoint(i * h_step, ((double)(devparms->wavebuf[chn][i]) + offset) * v_sense);
}
else
{
painter->drawLine(i * h_step, ((double)(devparms->wavebuf[chn][i]) + offset) * v_sense, (i + 1) * h_step, ((double)(devparms->wavebuf[chn][i + 1]) + offset) * v_sense);
}
@ -447,46 +452,26 @@ void SignalCurve::drawWidget(QPainter *painter, int curve_w, int curve_h)
if(devparms->countersrc)
{
char str[128];
QPainterPath path;
path.addRoundedRect(600, 6, 122, 20, 3, 3);
painter->fillPath(path, Qt::black);
painter->setPen(Qt::darkGray);
painter->drawRoundedRect(600, 6, 122, 20, 3, 3);
path = QPainterPath();
path.addRoundedRect(604, 9, 14, 14, 3, 3);
painter->fillPath(path, SignalColor[devparms->countersrc - 1]);
painter->setPen(Qt::black);
painter->drawLine(607, 12, 615, 12);
painter->drawLine(611, 12, 611, 20);
painter->setPen(Qt::white);
if((devparms->counterfreq < 15) || (devparms->counterfreq > 1.1e9))
{
strcpy(str, "< 15 Hz");
}
else
{
convert_to_metric_suffix(str, devparms->counterfreq, 4);
strcat(str, "Hz");
}
painter->drawText(622, 6, 100, 20, Qt::AlignCenter, str);
paintCounterLabel(painter, curve_w - 150, 6);
}
char str[128];
if(mainwindow->adjDialFunc == NAV_DIAL_FUNC_HOLDOFF)
{
convert_to_metric_suffix(str, devparms->triggerholdoff, 2);
strcat(str, "S");
paintLabel(painter, curve_w - 110, 5, 100, 20, str);
}
else if(mainwindow->adjDialFunc == ADJ_DIAL_FUNC_ACQ_AVG)
{
sprintf(str, "%i", devparms->acquireaverages);
paintLabel(painter, curve_w - 110, 5, 100, 20, str);
}
// clk_end = clock();
//
// cpu_time_used += ((double) (clk_end - clk_start)) / CLOCKS_PER_SEC;
@ -1548,9 +1533,63 @@ void SignalCurve::trig_stat_timer_handler()
}
void SignalCurve::paintLabel(QPainter *painter, int xpos, int ypos, int xw, int yh, const char *str)
{
QPainterPath path;
path.addRoundedRect(xpos, ypos, xw, yh, 3, 3);
painter->fillPath(path, Qt::black);
painter->setPen(Qt::white);
painter->drawRoundedRect(xpos, ypos, xw, yh, 3, 3);
painter->drawText(xpos, ypos, xw, yh, Qt::AlignCenter, str);
}
void SignalCurve::paintCounterLabel(QPainter *painter, int xpos, int ypos)
{
char str[128];
QPainterPath path;
path.addRoundedRect(xpos, ypos, 122, 20, 3, 3);
painter->fillPath(path, Qt::black);
painter->setPen(Qt::darkGray);
painter->drawRoundedRect(xpos, ypos, 122, 20, 3, 3);
path = QPainterPath();
path.addRoundedRect(xpos + 4, ypos + 3, 14, 14, 3, 3);
painter->fillPath(path, SignalColor[devparms->countersrc - 1]);
painter->setPen(Qt::black);
painter->drawLine(xpos + 7, ypos + 6, xpos + 15, ypos + 6);
painter->drawLine(xpos + 11, ypos + 6, xpos + 11, ypos + 14);
painter->setPen(Qt::white);
if((devparms->counterfreq < 15) || (devparms->counterfreq > 1.1e9))
{
strcpy(str, "< 15 Hz");
}
else
{
convert_to_metric_suffix(str, devparms->counterfreq, 4);
strcat(str, "Hz");
}
painter->drawText(xpos + 22, ypos, 100, 20, Qt::AlignCenter, str);
}

Wyświetl plik

@ -142,6 +142,8 @@ private:
void drawTrigCenterArrow(QPainter *, int, int);
void drawChanLabel(QPainter *, int, int, int);
void drawTopLabels(QPainter *);
void paintLabel(QPainter *, int, int, int, int, const char *);
void paintCounterLabel(QPainter *, int, int);
struct device_settings *devparms;

Wyświetl plik

@ -51,25 +51,15 @@ void UI_Mainwindow::navDial_timer_handler()
void UI_Mainwindow::adjdial_timer_handler()
{
if(adjDialCnt % 2)
{
adjDialLabel->setStyleSheet("background: #66FF99; font: 7pt;");
}
else
{
adjDialLabel->setStyleSheet(def_stylesh);
adjdial_timer->stop();
adjDialLabel->setStyleSheet("font: 7pt;");
}
adjDialLabel->setStyleSheet(def_stylesh);
if(++adjDialCnt > ADJ_DIAL_CNT_TIMEOUT)
{
adjdial_timer->stop();
adjDialLabel->setStyleSheet("font: 7pt;");
adjDialLabel->setStyleSheet(def_stylesh);
adjDialLabel->setText("");
adjDialLabel->setStyleSheet("font: 7pt;");
}
adjDialFunc = NAV_DIAL_FUNC_NONE;
}
@ -285,10 +275,6 @@ void UI_Mainwindow::scrn_timer_handler()
return;
}
// 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
@ -300,55 +286,10 @@ void UI_Mainwindow::scrn_timer_handler()
tmcdev_write(device, str);
// tmcdev_write(device, ":WAV:YOR?");
//
// n = tmcdev_read(device);
//
// if(n < 0)
// {
// printf("Can not read from device.\n");
// return;
// }
//
// devparms.preamble.yorigin[i] = atof(device->buf);
tmcdev_write(device, ":WAV:FORM BYTE");
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, &devparms.preamble, 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",
// devparms.preamble.format, devparms.preamble.type, devparms.preamble.points, devparms.preamble.count,
// devparms.preamble.xincrement[i], devparms.preamble.xorigin[i], devparms.preamble.xreference[i],
// devparms.preamble.yincrement[i], devparms.preamble.yorigin[i], devparms.preamble.yreference[i]);
tmcdev_write(device, ":WAV:DATA?");
n = tmcdev_read(device);
@ -370,8 +311,6 @@ void UI_Mainwindow::scrn_timer_handler()
return;
}
// yref = devparms.preamble.yreference[i];
for(j=0; j<n; j++)
{
devparms.wavebuf[i][j] = (device->buf[j] + 128);