From 63bfdb9cb907384f4aaf17c5227ef89a776fbee6 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 8 Aug 2012 17:10:44 +0000 Subject: [PATCH] dacs and adcs work git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@27 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qTabDeveloper.h | 28 +++++++++++++++++++++++++- slsDetectorGui/src/qTabDeveloper.cpp | 18 ++++++++++++++--- 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/slsDetectorGui/include/qTabDeveloper.h b/slsDetectorGui/include/qTabDeveloper.h index ff340dd72..ab1ca4c1b 100644 --- a/slsDetectorGui/include/qTabDeveloper.h +++ b/slsDetectorGui/include/qTabDeveloper.h @@ -25,6 +25,27 @@ class multiSlsDetector; using namespace std; +/**To override the spin box class to have an id and emit it*/ +class MyDoubleSpinBox:public QDoubleSpinBox{ +Q_OBJECT +private: + int myId; + private slots: + void valueChangedWithID() {emit editingFinished(myId);}; + public: + /** Overridden constructor from QDoubleSpinBox */ + MyDoubleSpinBox(int id,QWidget* parent = 0) + :QDoubleSpinBox(parent),myId(id){ + //setParent(parent); + connect(this,SIGNAL(editingFinished()), + this,SLOT(valueChangedWithID())); + } + signals: + void editingFinished(int myId); +}; + + + /** *@short sets up the Developer parameters */ @@ -69,7 +90,7 @@ private: QGroupBox *boxAdcs; QLabel *lblDacs[20]; QLabel *lblAdcs[20]; - QDoubleSpinBox *spinDacs[20]; + MyDoubleSpinBox *spinDacs[20]; QDoubleSpinBox *spinAdcs[20]; QTimer *adcTimer; @@ -102,6 +123,11 @@ private slots: */ void RefreshAdcs(); +/** Set Dac values + * @param id id of dac + */ +void SetDacValues(int id); + }; diff --git a/slsDetectorGui/src/qTabDeveloper.cpp b/slsDetectorGui/src/qTabDeveloper.cpp index 28963993f..4f188077b 100644 --- a/slsDetectorGui/src/qTabDeveloper.cpp +++ b/slsDetectorGui/src/qTabDeveloper.cpp @@ -128,8 +128,8 @@ void qTabDeveloper::SetupWidgetWindow(){ void qTabDeveloper::Initialization(){ connect(adcTimer, SIGNAL(timeout()), this, SLOT(RefreshAdcs())); - //for(int i=0;isetMaximum(10000); dacLayout->addWidget(lblDacs[i],(int)(i/2),((i%2)==0)?1:4); @@ -181,6 +181,18 @@ void qTabDeveloper::CreateADCWidgets(){ //------------------------------------------------------------------------------------------------------------------------------------------------- +void qTabDeveloper::SetDacValues(int id){ +#ifdef VERYVERBOSE + cout << "Setting dac:" <value() << endl; +#endif + + spinDacs[id]->setValue(myDet->setDAC(spinDacs[id]->value(),getSLSIndex(id))); +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + slsDetectorDefs::dacIndex qTabDeveloper::getSLSIndex(int index){ switch(detType){ case slsDetectorDefs::MYTHEN: