Work in progress.

merge-requests/1/head
Teuniz 2015-06-08 13:04:31 +02:00
rodzic d19a946c75
commit 3097930bb2
4 zmienionych plików z 101 dodań i 28 usunięć

Wyświetl plik

@ -205,7 +205,7 @@ void UI_Mainwindow::acqButtonClicked()
submenumemdepth.addAction("Auto", this, SLOT(set_memdepth_auto()));
if(devparms.modelserie == 6)
{
if(chns_on < 2)
if(chns_on < 3)
{
submenumemdepth.addAction("14K", this, SLOT(set_memdepth_14k()));
submenumemdepth.addAction("140K", this, SLOT(set_memdepth_140k()));

Wyświetl plik

@ -16,7 +16,7 @@ Some settings are checked regularly and will always be synchronized:
There are some peculiarities when testing with the DS6104 and the DS1054Z:
DS6104:
DS6104: (software version 00.01.04, hardware version 1.8)
======
USB connection: full speed (12MBit)

Wyświetl plik

@ -164,12 +164,13 @@ void UI_Mainwindow::save_memory_waveform()
chn,
chns=0,
hdl=-1,
bytes_rcvd,
bytes_rcvd=0,
mempnts,
yref[MAX_CHNS],
yor[MAX_CHNS],
smps_per_record,
datrecs=1;
datrecs=1,
empty_buf;
char str[128],
opath[MAX_PATHLEN];
@ -246,7 +247,7 @@ void UI_Mainwindow::save_memory_waveform()
wavbuf[i] = (short *)malloc(mempnts * sizeof(short));
if(wavbuf[i] == NULL)
{
strcpy(str, "Malloc error.");
sprintf(str, "Malloc error. line %i file %s", __LINE__, __FILE__);
goto OUT_ERROR;
}
}
@ -280,7 +281,7 @@ void UI_Mainwindow::save_memory_waveform()
if(yinc[chn] < 1e-6)
{
strcpy(str, "Error, parameter \"YINC\" out of range.");
sprintf(str, "Error, parameter \"YINC\" out of range. line %i file %s", __LINE__, __FILE__);
goto OUT_ERROR;
}
@ -292,7 +293,7 @@ void UI_Mainwindow::save_memory_waveform()
if((yref[chn] < 1) || (yref[chn] > 255))
{
strcpy(str, "Error, parameter \"YREF\" out of range.");
sprintf(str, "Error, parameter \"YREF\" out of range. line %i file %s", __LINE__, __FILE__);
goto OUT_ERROR;
}
@ -304,13 +305,20 @@ void UI_Mainwindow::save_memory_waveform()
if((yor[chn] < -255) || (yor[chn] > 255))
{
strcpy(str, "Error, parameter \"YOR\" out of range.");
sprintf(str, "Error, parameter \"YOR\" out of range. line %i file %s", __LINE__, __FILE__);
goto OUT_ERROR;
}
bytes_rcvd = 0;
if(devparms.modelserie != 1)
{
// tmcdev_write(device, ":WAV:RES");
for(j=0; ; j++)
tmcdev_write(device, ":WAV:BEG");
}
empty_buf = 0;
for(bytes_rcvd=0; bytes_rcvd<mempnts ;)
{
progress.setValue(bytes_rcvd);
@ -322,17 +330,41 @@ void UI_Mainwindow::save_memory_waveform()
goto OUT_ERROR;
}
sprintf(str, ":WAV:STAR %i", (j * SAV_MEM_BSZ) + 1);
tmcdev_write(device, str);
if(((j + 1) * SAV_MEM_BSZ) > mempnts)
if(devparms.modelserie == 6)
{
sprintf(str, ":WAV:STOP %i", mempnts);
// 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:STOP %i", (j + 1) * SAV_MEM_BSZ);
sprintf(str, ":WAV:STAR %i", bytes_rcvd + 1);
tmcdev_write(device, str);
if((bytes_rcvd + SAV_MEM_BSZ) > mempnts)
{
sprintf(str, ":WAV:STOP %i", mempnts);
}
else
{
sprintf(str, ":WAV:STOP %i", bytes_rcvd + SAV_MEM_BSZ);
}
}
tmcdev_write(device, str);
@ -343,7 +375,7 @@ void UI_Mainwindow::save_memory_waveform()
if(n < 0)
{
strcpy(str, "Can not read from device.");
sprintf(str, "Can not read from device. line %i file %s", __LINE__, __FILE__);
goto OUT_ERROR;
}
@ -351,20 +383,23 @@ void UI_Mainwindow::save_memory_waveform()
if(n > SAV_MEM_BSZ)
{
strcpy(str, "Datablock too big for buffer.");
sprintf(str, "Datablock too big for buffer. line %i file %s", __LINE__, __FILE__);
goto OUT_ERROR;
}
if(n < 1)
{
break;
if(empty_buf++ > 5)
{
break;
}
}
bytes_rcvd += n;
for(k=0; k<n; k++)
{
wavbuf[chn][(j * SAV_MEM_BSZ) + k] = (int)(((unsigned char *)device->buf)[k]) - yref[chn];
wavbuf[chn][bytes_rcvd + k] = (int)(((unsigned char *)device->buf)[k]) - yref[chn];
}
if(bytes_rcvd >= mempnts)
@ -372,6 +407,17 @@ void UI_Mainwindow::save_memory_waveform()
break;
}
}
if(devparms.modelserie != 1)
{
tmcdev_write(device, ":WAV:END");
}
if(bytes_rcvd < mempnts)
{
sprintf(str, "Download error. line %i file %s", __LINE__, __FILE__);
goto OUT_ERROR;
}
}
progress.reset();
@ -393,7 +439,15 @@ void UI_Mainwindow::save_memory_waveform()
scrn_timer->start(devparms.screen_timer_ival);
statusLabel->setText("Downloading finished");
if(bytes_rcvd < mempnts)
{
sprintf(str, "Download error. line %i file %s", __LINE__, __FILE__);
goto OUT_ERROR;
}
else
{
statusLabel->setText("Downloading finished");
}
opath[0] = 0;
if(recent_savedir[0]!=0)

Wyświetl plik

@ -155,17 +155,24 @@ void SignalCurve::drawWidget(QPainter *painter, int curve_w, int curve_h)
drawTopLabels(painter);
tmp = 407 - ((devparms->timebaseoffset / ((double)devparms->timebasescale * (double)devparms->hordivisions)) * 233);
if(tmp < 291)
if((devparms->memdepth > 1000) && !devparms->timebasedelayenable)
{
tmp = 286;
tmp = 405 - ((devparms->timebaseoffset / (devparms->memdepth / devparms->samplerate)) * 233);
}
else
{
tmp = 405 - ((devparms->timebaseoffset / ((double)devparms->timebasescale * (double)devparms->hordivisions)) * 233);
}
if(tmp < 289)
{
tmp = 284;
rot = 2;
}
else if(tmp > 523)
else if(tmp > 521)
{
tmp = 528;
tmp = 526;
rot = 0;
}
@ -651,6 +658,18 @@ void SignalCurve::drawTopLabels(QPainter *painter)
painter->fillRect(288 + 233 - x1, 16, x1, 8, QColor(64, 160, 255));
}
else if(devparms->memdepth > 1000)
{
dtmp1 = (devparms->hordivisions * devparms->timebasescale) / (devparms->memdepth / devparms->samplerate);
dtmp2 = devparms->timebaseoffset / dtmp1;
painter->fillRect(288, 16, (116 - (dtmp1 * 116)) - (dtmp2 * 116), 8, QColor(64, 160, 255));
x1 = (116 - (dtmp1 * 116)) + (dtmp2 * 116);
painter->fillRect(288 + 233 - x1, 16, x1, 8, QColor(64, 160, 255));
}
painter->drawRect(288, 16, 233, 8);