From e7211db951f60d92cabbca48d43a0131a404120d Mon Sep 17 00:00:00 2001 From: Teuniz Date: Wed, 15 Jul 2015 17:20:19 +0200 Subject: [PATCH] Work in progress. --- global.h | 5 +++- mainwindow.cpp | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+), 1 deletion(-) diff --git a/global.h b/global.h index 6846a8e..2b3bb6c 100644 --- a/global.h +++ b/global.h @@ -31,7 +31,7 @@ #define PROGRAM_NAME "DSRemote" -#define PROGRAM_VERSION "0.20_1507141906" +#define PROGRAM_VERSION "0.20_1507151719" #define MAX_PATHLEN 4096 @@ -60,6 +60,9 @@ #define LABEL_ACTIVE_CHAN4 4 #define LABEL_ACTIVE_TRIG 5 +#define TMC_GDS_DELAY 30000 + + struct waveform_preamble diff --git a/mainwindow.cpp b/mainwindow.cpp index dd5355e..b581c62 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -421,6 +421,8 @@ int UI_Mainwindow::get_device_settings() { sprintf(str, ":CHAN%i:BWL?", chn + 1); + usleep(TMC_GDS_DELAY); + if(tmc_write(str) != 11) { line = __LINE__; @@ -453,6 +455,8 @@ int UI_Mainwindow::get_device_settings() sprintf(str, ":CHAN%i:COUP?", chn + 1); + usleep(TMC_GDS_DELAY); + if(tmc_write(str) != 12) { line = __LINE__; @@ -485,6 +489,8 @@ int UI_Mainwindow::get_device_settings() sprintf(str, ":CHAN%i:DISP?", chn + 1); + usleep(TMC_GDS_DELAY); + if(tmc_write(str) != 12) { line = __LINE__; @@ -544,6 +550,8 @@ int UI_Mainwindow::get_device_settings() { sprintf(str, ":CHAN%i:IMP?", chn + 1); + usleep(TMC_GDS_DELAY); + if(tmc_write(str) != 11) { line = __LINE__; @@ -573,6 +581,8 @@ int UI_Mainwindow::get_device_settings() sprintf(str, ":CHAN%i:INV?", chn + 1); + usleep(TMC_GDS_DELAY); + if(tmc_write(str) != 11) { line = __LINE__; @@ -601,6 +611,8 @@ int UI_Mainwindow::get_device_settings() sprintf(str, ":CHAN%i:OFFS?", chn + 1); + usleep(TMC_GDS_DELAY); + if(tmc_write(str) != 12) { line = __LINE__; @@ -617,6 +629,8 @@ int UI_Mainwindow::get_device_settings() sprintf(str, ":CHAN%i:PROB?", chn + 1); + usleep(TMC_GDS_DELAY); + if(tmc_write(str) != 12) { line = __LINE__; @@ -633,6 +647,8 @@ int UI_Mainwindow::get_device_settings() sprintf(str, ":CHAN%i:SCAL?", chn + 1); + usleep(TMC_GDS_DELAY); + if(tmc_write(str) != 12) { line = __LINE__; @@ -649,6 +665,8 @@ int UI_Mainwindow::get_device_settings() sprintf(str, ":CHAN%i:VERN?", chn + 1); + usleep(TMC_GDS_DELAY); + if(tmc_write(str) != 12) { line = __LINE__; @@ -676,6 +694,8 @@ int UI_Mainwindow::get_device_settings() } } + usleep(TMC_GDS_DELAY); + if(tmc_write(":TIM:OFFS?") != 10) { line = __LINE__; @@ -690,6 +710,8 @@ int UI_Mainwindow::get_device_settings() devparms.timebaseoffset = atof(device->buf); + usleep(TMC_GDS_DELAY); + if(tmc_write(":TIM:SCAL?") != 10) { line = __LINE__; @@ -704,6 +726,8 @@ int UI_Mainwindow::get_device_settings() devparms.timebasescale = atof(device->buf); + usleep(TMC_GDS_DELAY); + if(tmc_write(":TIM:DEL:ENAB?") != 14) { line = __LINE__; @@ -730,6 +754,8 @@ int UI_Mainwindow::get_device_settings() goto OUT_ERROR; } + usleep(TMC_GDS_DELAY); + if(tmc_write(":TIM:DEL:OFFS?") != 14) { line = __LINE__; @@ -744,6 +770,8 @@ int UI_Mainwindow::get_device_settings() devparms.timebasedelayoffset = atof(device->buf); + usleep(TMC_GDS_DELAY); + if(tmc_write(":TIM:DEL:SCAL?") != 14) { line = __LINE__; @@ -760,6 +788,8 @@ int UI_Mainwindow::get_device_settings() if(devparms.modelserie != 1) { + usleep(TMC_GDS_DELAY); + if(tmc_write(":TIM:HREF:MODE?") != 15) { line = __LINE__; @@ -790,6 +820,8 @@ int UI_Mainwindow::get_device_settings() goto OUT_ERROR; } + usleep(TMC_GDS_DELAY); + if(tmc_write(":TIM:HREF:POS?") != 14) { line = __LINE__; @@ -805,6 +837,8 @@ int UI_Mainwindow::get_device_settings() devparms.timebasehrefpos = atoi(device->buf); + usleep(TMC_GDS_DELAY); + if(tmc_write(":TIM:MODE?") != 10) { line = __LINE__; @@ -837,6 +871,8 @@ int UI_Mainwindow::get_device_settings() if(devparms.modelserie != 1) { + usleep(TMC_GDS_DELAY); + if(tmc_write(":TIM:VERN?") != 10) { line = __LINE__; @@ -866,6 +902,8 @@ int UI_Mainwindow::get_device_settings() if((devparms.modelserie != 1) && (devparms.modelserie != 2)) { + usleep(TMC_GDS_DELAY); + if(tmc_write(":TIM:XY1:DISP?") != 14) { line = __LINE__; @@ -892,6 +930,8 @@ int UI_Mainwindow::get_device_settings() goto OUT_ERROR; } + usleep(TMC_GDS_DELAY); + if(tmc_write(":TIM:XY2:DISP?") != 14) { line = __LINE__; @@ -919,6 +959,8 @@ int UI_Mainwindow::get_device_settings() } } + usleep(TMC_GDS_DELAY); + if(tmc_write(":TRIG:COUP?") != 11) { line = __LINE__; @@ -953,6 +995,8 @@ int UI_Mainwindow::get_device_settings() goto OUT_ERROR; } + usleep(TMC_GDS_DELAY); + if(tmc_write(":TRIG:SWE?") != 10) { line = __LINE__; @@ -995,6 +1039,8 @@ int UI_Mainwindow::get_device_settings() goto OUT_ERROR; } + usleep(TMC_GDS_DELAY); + if(tmc_write(":TRIG:MODE?") != 11) { line = __LINE__; @@ -1053,6 +1099,8 @@ int UI_Mainwindow::get_device_settings() goto OUT_ERROR; } + usleep(TMC_GDS_DELAY); + if(tmc_write(":TRIG:STAT?") != 11) { line = __LINE__; @@ -1095,6 +1143,8 @@ int UI_Mainwindow::get_device_settings() goto OUT_ERROR; } + usleep(TMC_GDS_DELAY); + if(tmc_write(":TRIG:EDG:SLOP?") != 15) { line = __LINE__; @@ -1125,6 +1175,8 @@ int UI_Mainwindow::get_device_settings() goto OUT_ERROR; } + usleep(TMC_GDS_DELAY); + if(tmc_write(":TRIG:EDG:SOUR?") != 15) { line = __LINE__; @@ -1175,12 +1227,16 @@ int UI_Mainwindow::get_device_settings() { sprintf(str, ":TRIG:EDG:SOUR CHAN%i", chn + 1); + usleep(TMC_GDS_DELAY); + if(tmc_write(str) != 20) { line = __LINE__; goto OUT_ERROR; } + usleep(TMC_GDS_DELAY); + if(tmc_write(":TRIG:EDG:LEV?") != 14) { line = __LINE__; @@ -1200,6 +1256,8 @@ int UI_Mainwindow::get_device_settings() { sprintf(str, ":TRIG:EDG:SOUR CHAN%i", devparms.triggeredgesource + 1); + usleep(TMC_GDS_DELAY); + if(tmc_write(str) != 20) { line = __LINE__; @@ -1209,6 +1267,8 @@ int UI_Mainwindow::get_device_settings() if(devparms.triggeredgesource== 4) { + usleep(TMC_GDS_DELAY); + if(tmc_write(":TRIG:EDG:SOUR EXT") != 18) { line = __LINE__; @@ -1218,6 +1278,8 @@ int UI_Mainwindow::get_device_settings() if(devparms.triggeredgesource== 5) { + usleep(TMC_GDS_DELAY); + if(tmc_write(":TRIG:EDG:SOUR EXT5") != 19) { line = __LINE__; @@ -1227,6 +1289,8 @@ int UI_Mainwindow::get_device_settings() if(devparms.triggeredgesource== 6) { + usleep(TMC_GDS_DELAY); + if(tmc_write(":TRIG:EDG:SOUR AC") != 17) { line = __LINE__; @@ -1234,6 +1298,8 @@ int UI_Mainwindow::get_device_settings() } } + usleep(TMC_GDS_DELAY); + if(tmc_write(":TRIG:HOLD?") != 11) { line = __LINE__; @@ -1280,6 +1346,8 @@ int UI_Mainwindow::get_device_settings() } } + usleep(TMC_GDS_DELAY); + if(tmc_write(":ACQ:SRAT?") != 10) { line = __LINE__; @@ -1294,6 +1362,8 @@ int UI_Mainwindow::get_device_settings() devparms.samplerate = atof(device->buf); + usleep(TMC_GDS_DELAY); + if(tmc_write(":DISP:GRID?") != 11) { line = __LINE__; @@ -1324,6 +1394,8 @@ int UI_Mainwindow::get_device_settings() goto OUT_ERROR; } + usleep(TMC_GDS_DELAY); + if(tmc_write(":MEAS:COUN:SOUR?") != 16) { line = __LINE__; @@ -1362,6 +1434,8 @@ int UI_Mainwindow::get_device_settings() goto OUT_ERROR; } + usleep(TMC_GDS_DELAY); + if(tmc_write(":DISP:TYPE?") != 11) { line = __LINE__; @@ -1388,6 +1462,8 @@ int UI_Mainwindow::get_device_settings() goto OUT_ERROR; } + usleep(TMC_GDS_DELAY); + if(tmc_write(":ACQ:TYPE?") != 10) { line = __LINE__; @@ -1422,6 +1498,8 @@ int UI_Mainwindow::get_device_settings() goto OUT_ERROR; } + usleep(TMC_GDS_DELAY); + if(tmc_write(":ACQ:AVER?") != 10) { line = __LINE__;