diff --git a/README.md b/README.md index ecb2339..323ed93 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,8 @@ How to compile: Now you can run the program by typing: dsremote - Read also the readme_usbtcm_driver.txt file. + Read also the file readme_usbtcm_driver.txt + and the file notes.txt. diff --git a/interface.cpp b/interface.cpp index 94d0faf..251fdef 100644 --- a/interface.cpp +++ b/interface.cpp @@ -1325,10 +1325,16 @@ void UI_Mainwindow::trigMenuButtonClicked() submenusource.setTitle("Source"); submenusource.addAction("CH1", this, SLOT(trigger_source_ch1())); - submenusource.addAction("CH2", this, SLOT(trigger_source_ch2())); - if(devparms.channel_cnt == 4) + if(devparms.channel_cnt > 1) + { + submenusource.addAction("CH2", this, SLOT(trigger_source_ch2())); + } + if(devparms.channel_cnt > 2) { submenusource.addAction("CH3", this, SLOT(trigger_source_ch3())); + } + if(devparms.channel_cnt > 3) + { submenusource.addAction("CH4", this, SLOT(trigger_source_ch4())); } submenusource.addAction("EXT", this, SLOT(trigger_source_ext())); diff --git a/mainwindow.cpp b/mainwindow.cpp index 44b1698..19c4713 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -215,28 +215,24 @@ UI_Mainwindow::UI_Mainwindow() ch1InputLabel = new QLabel(verticalGrpBox); ch1InputLabel->setGeometry(12, 15, 50, 18); -// ch1InputLabel->setText("AC 50 BW"); 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->setText("AC 50 BW"); 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->setText("AC 50 BW"); 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->setText("AC 50 BW"); ch4InputLabel->setStyleSheet("color: #C0C000; font: 7pt;"); ch4Button = new QPushButton(verticalGrpBox); ch4Button->setGeometry(15, 150, 40, 18); @@ -555,6 +551,27 @@ void UI_Mainwindow::open_connection() QApplication::restoreOverrideCursor(); + if(devparms.channel_cnt < 4) + { + ch4Button->setEnabled(false); + + ch4Button->setVisible(false); + } + + if(devparms.channel_cnt < 3) + { + ch3Button->setEnabled(false); + + ch3Button->setVisible(false); + } + + if(devparms.channel_cnt < 2) + { + ch2Button->setEnabled(false); + + ch2Button->setVisible(false); + } + 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))); @@ -1569,19 +1586,19 @@ int UI_Mainwindow::get_device_settings() } } -// if(tmcdev_write(device, ":ACQ:SRAT?") != 10) -// { -// line = __LINE__; -// goto OUT_ERROR; -// } -// -// if(tmcdev_read(device) < 1) -// { -// line = __LINE__; -// goto OUT_ERROR; -// } -// -// devparms.samplerate = atof(device->buf); + if(tmcdev_write(device, ":ACQ:SRAT?") != 10) + { + line = __LINE__; + goto OUT_ERROR; + } + + if(tmcdev_read(device) < 1) + { + line = __LINE__; + goto OUT_ERROR; + } + + devparms.samplerate = atof(device->buf); return 0; diff --git a/signalcurve.cpp b/signalcurve.cpp index 3fa3fe2..2601736 100644 --- a/signalcurve.cpp +++ b/signalcurve.cpp @@ -156,7 +156,7 @@ void SignalCurve::drawWidget(QPainter *painter, int curve_w, int curve_h) painter->fillRect(0, curve_h - 30, curve_w, curve_h, QColor(32, 32, 32)); - for(i=0; ichannel_cnt; i++) { drawChanLabel(painter, 8 + (i * 125), curve_h - 25, i); } @@ -252,7 +252,7 @@ void SignalCurve::drawWidget(QPainter *painter, int curve_w, int curve_h) drawTrigCenterArrow(painter, curve_w / 2, 0); - for(chn=0; chnchannel_cnt; chn++) { if(!devparms->chandisplay[chn]) { @@ -295,7 +295,7 @@ void SignalCurve::drawWidget(QPainter *painter, int curve_w, int curve_h) h_step = (double)curve_w / (double)bufsize; - for(chn=0; chnchannel_cnt; chn++) { if(!devparms->chandisplay[chn]) { @@ -1097,7 +1097,7 @@ void SignalCurve::mousePressEvent(QMouseEvent *press_event) } else { - for(chn=0; chnchannel_cnt; chn++) { if(!devparms->chandisplay[chn]) { @@ -1220,7 +1220,7 @@ void SignalCurve::mouseReleaseEvent(QMouseEvent *release_event) } else { - for(chn=0; chnchannel_cnt; chn++) { if(!devparms->chandisplay[chn]) { @@ -1330,7 +1330,7 @@ void SignalCurve::mouseMoveEvent(QMouseEvent *move_event) } else { - for(chn=0; chnchannel_cnt; chn++) { if(!devparms->chandisplay[chn]) {