Work in progress.

merge-requests/1/head
Teuniz 2015-06-08 16:52:12 +02:00
rodzic b4c4e1ee92
commit fedcec0ad4
5 zmienionych plików z 203 dodań i 80 usunięć

Wyświetl plik

@ -182,7 +182,8 @@ void UI_Mainwindow::navDialReleased()
void UI_Mainwindow::acqButtonClicked() void UI_Mainwindow::acqButtonClicked()
{ {
int chn, int chn,
chns_on=0; chns_on=0,
dual=0;
QMenu menu, QMenu menu,
submenuacquisition, submenuacquisition,
@ -196,6 +197,11 @@ void UI_Mainwindow::acqButtonClicked()
} }
} }
if((devparms.chandisplay[0] && devparms.chandisplay[1]) || (devparms.chandisplay[2] && devparms.chandisplay[3]))
{
dual = 1;
}
submenuacquisition.setTitle("Mode"); submenuacquisition.setTitle("Mode");
submenuacquisition.addAction("Normal", this, SLOT(set_acq_normal())); submenuacquisition.addAction("Normal", this, SLOT(set_acq_normal()));
submenuacquisition.addAction("Average", this, SLOT(set_acq_average())); submenuacquisition.addAction("Average", this, SLOT(set_acq_average()));
@ -205,7 +211,7 @@ void UI_Mainwindow::acqButtonClicked()
submenumemdepth.addAction("Auto", this, SLOT(set_memdepth_auto())); submenumemdepth.addAction("Auto", this, SLOT(set_memdepth_auto()));
if(devparms.modelserie == 6) if(devparms.modelserie == 6)
{ {
if(chns_on < 3) if(!dual)
{ {
submenumemdepth.addAction("14K", this, SLOT(set_memdepth_14k())); submenumemdepth.addAction("14K", this, SLOT(set_memdepth_14k()));
submenumemdepth.addAction("140K", this, SLOT(set_memdepth_140k())); submenumemdepth.addAction("140K", this, SLOT(set_memdepth_140k()));
@ -222,33 +228,66 @@ void UI_Mainwindow::acqButtonClicked()
submenumemdepth.addAction("70M", this, SLOT(set_memdepth_70m())); submenumemdepth.addAction("70M", this, SLOT(set_memdepth_70m()));
} }
} }
else if(devparms.modelserie == 1) else if((devparms.modelserie == 2) || (devparms.modelserie == 4))
{ {
if(chns_on < 2) if(chns_on < 2)
{
submenumemdepth.addAction("12K", this, SLOT(set_memdepth_12k()));
submenumemdepth.addAction("120K", this, SLOT(set_memdepth_120k()));
submenumemdepth.addAction("1.2M", this, SLOT(set_memdepth_1200k()));
submenumemdepth.addAction("12M", this, SLOT(set_memdepth_12m()));
submenumemdepth.addAction("24M", this, SLOT(set_memdepth_24m()));
}
else if(chns_on < 3)
{ {
submenumemdepth.addAction("6K", this, SLOT(set_memdepth_6k())); submenumemdepth.addAction("14K", this, SLOT(set_memdepth_14k()));
submenumemdepth.addAction("60K", this, SLOT(set_memdepth_60k())); submenumemdepth.addAction("140K", this, SLOT(set_memdepth_140k()));
submenumemdepth.addAction("600K", this, SLOT(set_memdepth_600k())); submenumemdepth.addAction("1.4M", this, SLOT(set_memdepth_1400k()));
submenumemdepth.addAction("6M", this, SLOT(set_memdepth_6m())); submenumemdepth.addAction("14M", this, SLOT(set_memdepth_14m()));
submenumemdepth.addAction("12M", this, SLOT(set_memdepth_12m())); if(devparms.modelserie == 2)
{
submenumemdepth.addAction("56M", this, SLOT(set_memdepth_56m()));
}
else
{
submenumemdepth.addAction("140M", this, SLOT(set_memdepth_140m()));
}
} }
else else
{ {
submenumemdepth.addAction("3K", this, SLOT(set_memdepth_3k())); submenumemdepth.addAction("7K", this, SLOT(set_memdepth_7k()));
submenumemdepth.addAction("30K", this, SLOT(set_memdepth_30k())); submenumemdepth.addAction("70K", this, SLOT(set_memdepth_70k()));
submenumemdepth.addAction("300K", this, SLOT(set_memdepth_300k())); submenumemdepth.addAction("700K", this, SLOT(set_memdepth_700k()));
submenumemdepth.addAction("3M", this, SLOT(set_memdepth_3m())); submenumemdepth.addAction("7M", this, SLOT(set_memdepth_7m()));
submenumemdepth.addAction("6M", this, SLOT(set_memdepth_6m())); if(devparms.modelserie == 2)
{
submenumemdepth.addAction("28M", this, SLOT(set_memdepth_28m()));
}
else
{
submenumemdepth.addAction("70M", this, SLOT(set_memdepth_70m()));
}
} }
} }
else if(devparms.modelserie == 1)
{
if(chns_on < 2)
{
submenumemdepth.addAction("12K", this, SLOT(set_memdepth_12k()));
submenumemdepth.addAction("120K", this, SLOT(set_memdepth_120k()));
submenumemdepth.addAction("1.2M", this, SLOT(set_memdepth_1200k()));
submenumemdepth.addAction("12M", this, SLOT(set_memdepth_12m()));
submenumemdepth.addAction("24M", this, SLOT(set_memdepth_24m()));
}
else if(chns_on < 3)
{
submenumemdepth.addAction("6K", this, SLOT(set_memdepth_6k()));
submenumemdepth.addAction("60K", this, SLOT(set_memdepth_60k()));
submenumemdepth.addAction("600K", this, SLOT(set_memdepth_600k()));
submenumemdepth.addAction("6M", this, SLOT(set_memdepth_6m()));
submenumemdepth.addAction("12M", this, SLOT(set_memdepth_12m()));
}
else
{
submenumemdepth.addAction("3K", this, SLOT(set_memdepth_3k()));
submenumemdepth.addAction("30K", this, SLOT(set_memdepth_30k()));
submenumemdepth.addAction("300K", this, SLOT(set_memdepth_300k()));
submenumemdepth.addAction("3M", this, SLOT(set_memdepth_3m()));
submenumemdepth.addAction("6M", this, SLOT(set_memdepth_6m()));
}
}
menu.addMenu(&submenumemdepth); menu.addMenu(&submenumemdepth);
menu.exec(acqButton->mapToGlobal(QPoint(0,0))); menu.exec(acqButton->mapToGlobal(QPoint(0,0)));
@ -447,6 +486,22 @@ void UI_Mainwindow::set_memdepth_140m()
} }
void UI_Mainwindow::set_memdepth_28m()
{
statusLabel->setText("Memory depth: 28M");
tmcdev_write(device, ":ACQ:MDEP 28000000");
}
void UI_Mainwindow::set_memdepth_56m()
{
statusLabel->setText("Memory depth: 56M");
tmcdev_write(device, ":ACQ:MDEP 56000000");
}
void UI_Mainwindow::set_acq_normal() void UI_Mainwindow::set_acq_normal()
{ {
if(devparms.acquiretype == 0) if(devparms.acquiretype == 0)
@ -708,6 +763,24 @@ void UI_Mainwindow::utilButtonClicked()
void UI_Mainwindow::helpButtonClicked() void UI_Mainwindow::helpButtonClicked()
{ {
show_howto_operate();
}
void UI_Mainwindow::show_howto_operate()
{
QMessageBox msgBox;
msgBox.setText(
"Use the mousewheel to change the dials. In order to simulate a push on a dial,"
"click on it with the right mouse button.\n"
"To toggle the delayed timebase, right-click on the timebase dial.\n"
"To set the horizontal position to zero, right-click on the horizontal position dial.\n"
"To set the vertical offset to zero, right-click on the vertical position dial.\n\n"
"In addition of using the dials to change the scale and offset of the traces and the trigger position,"
"you can use the mouse to drag the colored arrows aside of the plot.\n"
);
msgBox.exec();
} }

Wyświetl plik

@ -1861,4 +1861,3 @@ void UI_Mainwindow::get_device_model(const char *str)

Wyświetl plik

@ -208,6 +208,7 @@ private slots:
void test_timer_handler(); void test_timer_handler();
void show_about_dialog(); void show_about_dialog();
void show_howto_operate();
void open_connection(); void open_connection();
void close_connection(); void close_connection();
void open_settings_dialog(); void open_settings_dialog();
@ -338,6 +339,8 @@ private slots:
void set_memdepth_1400k(); void set_memdepth_1400k();
void set_memdepth_14m(); void set_memdepth_14m();
void set_memdepth_140m(); void set_memdepth_140m();
void set_memdepth_28m();
void set_memdepth_56m();
protected: protected:
void closeEvent(QCloseEvent *); void closeEvent(QCloseEvent *);

Wyświetl plik

@ -90,6 +90,7 @@ UI_Mainwindow::UI_Mainwindow()
helpmenu = new QMenu; helpmenu = new QMenu;
helpmenu->setTitle("Help"); helpmenu->setTitle("Help");
helpmenu->addAction("How to operate", this, SLOT(helpButtonClicked()));
helpmenu->addAction("About", this, SLOT(show_about_dialog())); helpmenu->addAction("About", this, SLOT(show_about_dialog()));
menubar->addMenu(helpmenu); menubar->addMenu(helpmenu);

Wyświetl plik

@ -265,6 +265,8 @@ void UI_Mainwindow::save_memory_waveform()
continue; continue;
} }
printf("start channel x\n");
sprintf(str, ":WAV:SOUR CHAN%i", chn + 1); sprintf(str, ":WAV:SOUR CHAN%i", chn + 1);
tmcdev_write(device, str); tmcdev_write(device, str);
@ -311,7 +313,11 @@ void UI_Mainwindow::save_memory_waveform()
if(devparms.modelserie != 1) if(devparms.modelserie != 1)
{ {
// tmcdev_write(device, ":WAV:RES"); sprintf(str, ":WAV:POIN %i", mempnts);
tmcdev_write(device, str);
tmcdev_write(device, ":WAV:RES");
tmcdev_write(device, ":WAV:BEG"); tmcdev_write(device, ":WAV:BEG");
} }
@ -330,28 +336,7 @@ void UI_Mainwindow::save_memory_waveform()
goto OUT_ERROR; goto OUT_ERROR;
} }
if(devparms.modelserie == 6) if(devparms.modelserie == 1)
{
// tmcdev_write(device, ":WAV:STAT?");
//
// tmcdev_read(device);
//
// printf(":WAV:STAT?: %s\n", device->buf);
sprintf(str, ":WAV:STAR %i", bytes_rcvd);
tmcdev_write(device, str);
if((bytes_rcvd + SAV_MEM_BSZ) > mempnts)
{
sprintf(str, ":WAV:STOP %i", mempnts - 1);
}
else
{
sprintf(str, ":WAV:STOP %i", bytes_rcvd + SAV_MEM_BSZ - 1);
}
}
else
{ {
sprintf(str, ":WAV:STAR %i", bytes_rcvd + 1); sprintf(str, ":WAV:STAR %i", bytes_rcvd + 1);
@ -365,9 +350,9 @@ void UI_Mainwindow::save_memory_waveform()
{ {
sprintf(str, ":WAV:STOP %i", bytes_rcvd + SAV_MEM_BSZ); sprintf(str, ":WAV:STOP %i", bytes_rcvd + SAV_MEM_BSZ);
} }
}
tmcdev_write(device, str); tmcdev_write(device, str);
}
tmcdev_write(device, ":WAV:DATA?"); tmcdev_write(device, ":WAV:DATA?");
@ -379,29 +364,49 @@ void UI_Mainwindow::save_memory_waveform()
goto OUT_ERROR; goto OUT_ERROR;
} }
printf("received %i bytes\n", n); printf("received %i bytes, total %i bytes\n", n, n + bytes_rcvd);
if(n > SAV_MEM_BSZ) if(devparms.modelserie == 1)
{ {
sprintf(str, "Datablock too big for buffer. line %i file %s", __LINE__, __FILE__); if(n > SAV_MEM_BSZ)
goto OUT_ERROR; {
sprintf(str, "Datablock too big for buffer. line %i file %s", __LINE__, __FILE__);
goto OUT_ERROR;
}
}
else
{
if(n > mempnts)
{
sprintf(str, "Datablock too big for buffer. line %i file %s", __LINE__, __FILE__);
goto OUT_ERROR;
}
} }
if(n < 1) if(n < 1)
{ {
if(empty_buf++ > 5) if(empty_buf++ > 100)
{ {
break; break;
} }
} }
else
bytes_rcvd += n; {
empty_buf = 0;
}
for(k=0; k<n; k++) for(k=0; k<n; k++)
{ {
if((bytes_rcvd + k) >= mempnts)
{
break;
}
wavbuf[chn][bytes_rcvd + k] = (int)(((unsigned char *)device->buf)[k]) - yref[chn]; wavbuf[chn][bytes_rcvd + k] = (int)(((unsigned char *)device->buf)[k]) - yref[chn];
} }
bytes_rcvd += n;
if(bytes_rcvd >= mempnts) if(bytes_rcvd >= mempnts)
{ {
break; break;
@ -422,17 +427,38 @@ void UI_Mainwindow::save_memory_waveform()
progress.reset(); progress.reset();
tmcdev_write(device, ":WAV:MODE NORM"); for(chn=0; chn<MAX_CHNS; chn++)
tmcdev_write(device, ":WAV:STAR 1");
if(devparms.modelserie == 1)
{ {
tmcdev_write(device, ":WAV:STOP 1200"); if(!devparms.chandisplay[chn])
} {
else continue;
{ }
tmcdev_write(device, ":WAV:STOP 1400");
sprintf(str, ":WAV:SOUR CHAN%i", chn + 1);
tmcdev_write(device, str);
tmcdev_write(device, ":WAV:MODE NORM");
if(devparms.modelserie == 6)
{
tmcdev_write(device, ":WAV:STAR 0");
}
else
{
tmcdev_write(device, ":WAV:STAR 1");
}
if(devparms.modelserie == 1)
{
tmcdev_write(device, ":WAV:STOP 1200");
}
else
{
tmcdev_write(device, ":WAV:STOP 1400");
tmcdev_write(device, ":WAV:POIN 1400");
}
} }
stat_timer->start(devparms.status_timer_ival); stat_timer->start(devparms.status_timer_ival);
@ -546,21 +572,13 @@ OUT_ERROR:
progress.reset(); progress.reset();
tmcdev_write(device, ":WAV:MODE NORM");
tmcdev_write(device, ":WAV:STAR 1");
if(devparms.modelserie == 1)
{
tmcdev_write(device, ":WAV:STOP 1200");
}
else
{
tmcdev_write(device, ":WAV:STOP 1400");
}
statusLabel->setText("Downloading aborted"); statusLabel->setText("Downloading aborted");
if(hdl >= 0)
{
edfclose_file(hdl);
}
if(progress.wasCanceled() == false) if(progress.wasCanceled() == false)
{ {
QMessageBox msgBox; QMessageBox msgBox;
@ -569,9 +587,38 @@ OUT_ERROR:
msgBox.exec(); msgBox.exec();
} }
if(hdl >= 0) for(chn=0; chn<MAX_CHNS; chn++)
{ {
edfclose_file(hdl); if(!devparms.chandisplay[chn])
{
continue;
}
sprintf(str, ":WAV:SOUR CHAN%i", chn + 1);
tmcdev_write(device, str);
tmcdev_write(device, ":WAV:MODE NORM");
if(devparms.modelserie == 6)
{
tmcdev_write(device, ":WAV:STAR 0");
}
else
{
tmcdev_write(device, ":WAV:STAR 1");
}
if(devparms.modelserie == 1)
{
tmcdev_write(device, ":WAV:STOP 1200");
}
else
{
tmcdev_write(device, ":WAV:STOP 1400");
tmcdev_write(device, ":WAV:POIN 1400");
}
} }
for(chn=0; chn<MAX_CHNS; chn++) for(chn=0; chn<MAX_CHNS; chn++)