mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-24 23:30:03 +02:00
The timing mode works now
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@12 af1100a4-978c-4157-bff7-07162d2ba061
This commit is contained in:
parent
69e6500522
commit
31b65642cb
@ -9,15 +9,19 @@
|
||||
#define QDEFS_H
|
||||
|
||||
#include <iostream>
|
||||
#include <QMessageBox>
|
||||
using namespace std;
|
||||
|
||||
class qDefs
|
||||
{
|
||||
class qDefs:public QWidget{
|
||||
public:
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
/** Empty Constructor
|
||||
*/
|
||||
qDefs(){};
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
/** unit of time
|
||||
*/
|
||||
enum timeUnit{
|
||||
@ -29,6 +33,7 @@ public:
|
||||
NANOSECONDS /** ns */
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
/** returns the value in ns to send to server.
|
||||
* @param unit unit of time
|
||||
@ -49,7 +54,20 @@ public:
|
||||
return valueNS;
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
/**displays an error message
|
||||
* @param errorMessage the message to be displayed
|
||||
* @param source is the tab or the source of the error
|
||||
* */
|
||||
static void ErrorMessage(string errorMessage,char source[])
|
||||
{
|
||||
static QMessageBox* msgBox;
|
||||
msgBox= new QMessageBox(QMessageBox::Warning,source,tr(errorMessage.c_str()),QMessageBox::Ok, msgBox);
|
||||
msgBox->exec();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
};
|
||||
|
||||
|
@ -27,11 +27,12 @@ class slsDetectorUtils;
|
||||
#include <QGridLayout>
|
||||
#include <QResizeEvent>
|
||||
|
||||
|
||||
/** To Over-ride the QTabWidget class to get the tabBar */
|
||||
class MyTabWidget:public QTabWidget{
|
||||
public:
|
||||
MyTabWidget(QWidget* parent = 0) {setParent(parent);}
|
||||
//Overridden method from QTabWidget
|
||||
/** Overridden method from QTabWidget */
|
||||
QTabBar* tabBar(){return QTabWidget::tabBar();}
|
||||
};
|
||||
|
||||
@ -53,11 +54,9 @@ public:
|
||||
*/
|
||||
qDetectorMain(int argc, char **argv, QApplication *app, QWidget *parent = 0);
|
||||
|
||||
/**Destructor
|
||||
*/
|
||||
/**Destructor */
|
||||
~qDetectorMain();
|
||||
|
||||
|
||||
private:
|
||||
/** The Qt Application */
|
||||
QApplication *theApp;
|
||||
@ -73,12 +72,12 @@ private:
|
||||
int heightPlotWindow;
|
||||
/** default height of central widgetwhen plot Window when docked */
|
||||
int heightCentralWidget;
|
||||
/** The default zooming tool tip */
|
||||
QString zoomToolTip;
|
||||
/** The default tab heading color */
|
||||
QColor defaultTabColor;
|
||||
/** enumeration of the tabs */
|
||||
enum {Measurement, Settings, DataOutput, Plot, Actions, Advanced, Debugging, Developer, NumberOfTabs };
|
||||
|
||||
QColor defaultTabColor;
|
||||
QString zoomToolTip;
|
||||
|
||||
/* Scroll Area for the tabs**/
|
||||
QScrollArea *scroll[NumberOfTabs];
|
||||
/**Measurement tab */
|
||||
@ -99,8 +98,6 @@ private:
|
||||
qTabDeveloper *tab_developer;
|
||||
/**if the developer tab should be enabled,known from command line */
|
||||
int isDeveloper;
|
||||
|
||||
|
||||
/**Sets up the layout of the widget
|
||||
*/
|
||||
void SetUpWidgetWindow();
|
||||
|
@ -1,5 +1,6 @@
|
||||
/** Qt Project Class Headers */
|
||||
#include "qDetectorMain.h"
|
||||
#include "qDefs.h"
|
||||
#include "qDrawPlot.h"
|
||||
#include "qTabMeasurement.h"
|
||||
#include "qTabDataOutput.h"
|
||||
@ -22,6 +23,8 @@ using namespace std;
|
||||
|
||||
#define Detector_Index 0
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
int main (int argc, char **argv) {
|
||||
|
||||
QApplication *theApp = new QApplication(argc, argv);
|
||||
@ -31,9 +34,7 @@ int main (int argc, char **argv) {
|
||||
return theApp->exec();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
qDetectorMain::qDetectorMain(int argc, char **argv, QApplication *app, QWidget *parent) :
|
||||
QMainWindow(parent), theApp(app),myPlot(NULL),tabs(NULL),isDeveloper(0){
|
||||
@ -52,14 +53,11 @@ qDetectorMain::qDetectorMain(int argc, char **argv, QApplication *app, QWidget *
|
||||
cout<<"-developer \t : \t Enables the developer tab"<<endl;
|
||||
//cout<<"-id i \t : \t Sets the detector to id i (the default is 0). ";
|
||||
//cout<<"Required only when more than one detector is connected in parallel."<<endl;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
qDetectorMain::~qDetectorMain(){
|
||||
delete myDet;
|
||||
@ -67,9 +65,7 @@ qDetectorMain::~qDetectorMain(){
|
||||
if (centralwidget) delete centralwidget;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qDetectorMain::SetUpWidgetWindow(){
|
||||
|
||||
@ -134,9 +130,7 @@ void qDetectorMain::SetUpWidgetWindow(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qDetectorMain::SetUpDetector(){
|
||||
|
||||
@ -151,6 +145,18 @@ void qDetectorMain::SetUpDetector(){
|
||||
myDet = 0;
|
||||
}
|
||||
else{
|
||||
/** Check if type valid. If not, exit*/
|
||||
switch(myDet->getDetectorsType()){
|
||||
case slsDetectorDefs::MYTHEN: break;
|
||||
case slsDetectorDefs::EIGER: break;
|
||||
case slsDetectorDefs::GOTTHARD: break;
|
||||
default:
|
||||
string detName = myDet->slsDetectorBase::getDetectorType(myDet->getDetectorsType());
|
||||
string hostname = myDet->getHostname(Detector_Index);
|
||||
string errorMess = string("ERROR: ")+hostname+string(" has unknown detector type \"")+detName+string("\". Exiting GUI.");
|
||||
qDefs::ErrorMessage(errorMess,"Main: ERROR");
|
||||
exit(-1);
|
||||
}
|
||||
setWindowTitle("SLS Detector GUI : "+QString(slsDetectorBase::getDetectorType(myDet->getDetectorsType()).c_str())+" - "+QString(myDet->getHostname(Detector_Index).c_str()));
|
||||
#ifdef VERBOSE
|
||||
cout<<endl<<"Type : "<<slsDetectorBase::getDetectorType(myDet->getDetectorsType())<<"\t\t\tDetector : "<<myDet->getHostname(Detector_Index)<<endl;
|
||||
@ -159,7 +165,7 @@ void qDetectorMain::SetUpDetector(){
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qDetectorMain::Initialization(){
|
||||
/** Dockable Plot*/
|
||||
@ -205,6 +211,7 @@ void qDetectorMain::Initialization(){
|
||||
zoomToolTip = dockWidgetPlot->toolTip();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qDetectorMain::SetDeveloperMode(bool b){
|
||||
#ifdef VERBOSE
|
||||
@ -213,6 +220,7 @@ void qDetectorMain::SetDeveloperMode(bool b){
|
||||
tabs->setTabEnabled(Developer,b);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qDetectorMain::SetDebugMode(bool b){
|
||||
#ifdef VERBOSE
|
||||
@ -221,21 +229,24 @@ void qDetectorMain::SetDebugMode(bool b){
|
||||
tabs->setTabEnabled(Debugging,b);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qDetectorMain::SetBeamlineMode(bool b){
|
||||
#ifdef VERBOSE
|
||||
cout<<"Setting Beamline Mode to "<<b<<endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qDetectorMain::SetExpertMode(bool b){
|
||||
#ifdef VERBOSE
|
||||
cout<<"Setting Expert Mode to "<<b<<endl;
|
||||
#endif
|
||||
tabs->setTabEnabled(Advanced,b);
|
||||
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qDetectorMain::refresh(int index){
|
||||
if(!tabs->isTabEnabled(index))
|
||||
@ -248,6 +259,7 @@ void qDetectorMain::refresh(int index){
|
||||
tabs->tabBar()->setTabTextColor(index,QColor(0,0,200,255));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qDetectorMain::SetDockableMode(bool b){
|
||||
#ifdef VERBOSE
|
||||
@ -261,6 +273,7 @@ void qDetectorMain::SetDockableMode(bool b){
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qDetectorMain::OpenSetup(){
|
||||
#ifdef VERBOSE
|
||||
@ -268,6 +281,7 @@ void qDetectorMain::OpenSetup(){
|
||||
#endif
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qDetectorMain::SaveSetup(){
|
||||
#ifdef VERBOSE
|
||||
@ -275,6 +289,7 @@ void qDetectorMain::SaveSetup(){
|
||||
#endif
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qDetectorMain::MeasurementWizard(){
|
||||
#ifdef VERBOSE
|
||||
@ -282,6 +297,8 @@ void qDetectorMain::MeasurementWizard(){
|
||||
#endif
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qDetectorMain::OpenConfiguration(){
|
||||
#ifdef VERBOSE
|
||||
@ -289,6 +306,7 @@ void qDetectorMain::OpenConfiguration(){
|
||||
#endif
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qDetectorMain::SaveConfiguration(){
|
||||
#ifdef VERBOSE
|
||||
@ -296,6 +314,7 @@ void qDetectorMain::SaveConfiguration(){
|
||||
#endif
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qDetectorMain::EnergyCalibration(){
|
||||
#ifdef VERBOSE
|
||||
@ -303,6 +322,7 @@ void qDetectorMain::EnergyCalibration(){
|
||||
#endif
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qDetectorMain::AngularCalibration(){
|
||||
#ifdef VERBOSE
|
||||
@ -310,6 +330,7 @@ void qDetectorMain::AngularCalibration(){
|
||||
#endif
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qDetectorMain::Version(){
|
||||
#ifdef VERBOSE
|
||||
@ -317,6 +338,7 @@ void qDetectorMain::Version(){
|
||||
#endif
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qDetectorMain::About(){
|
||||
#ifdef VERBOSE
|
||||
@ -324,6 +346,7 @@ void qDetectorMain::About(){
|
||||
#endif
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qDetectorMain::ResizeMainWindow(bool b){
|
||||
#ifdef VERBOSE
|
||||
@ -356,14 +379,9 @@ void qDetectorMain::resizeEvent(QResizeEvent* event){
|
||||
}
|
||||
}
|
||||
event->accept();
|
||||
#ifdef VERBOSE
|
||||
cout<<"height:"<<height()<<endl;
|
||||
cout<<"dockWidgetPlot height:"<<dockWidgetPlot->height()<<endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qDetectorMain::EnableTabs(){
|
||||
#ifdef VERBOSE
|
||||
@ -395,6 +413,7 @@ void qDetectorMain::EnableTabs(){
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qDetectorMain::SetZoomToolTip(bool disable){
|
||||
@ -403,3 +422,5 @@ void qDetectorMain::SetZoomToolTip(bool disable){
|
||||
else
|
||||
dockWidgetPlot->setToolTip(zoomToolTip);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -23,7 +23,7 @@ using namespace std;
|
||||
#define Detector_Index 0
|
||||
#define UndefinedSettings 7
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
qTabMeasurement::qTabMeasurement(QWidget *parent,slsDetectorUtils*& detector, qDrawPlot*& plot):
|
||||
QWidget(parent),myDet(detector),myPlot(plot){
|
||||
@ -35,36 +35,38 @@ qTabMeasurement::qTabMeasurement(QWidget *parent,slsDetectorUtils*& detector, qD
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
qTabMeasurement::~qTabMeasurement(){
|
||||
delete myDet;
|
||||
delete myPlot;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qTabMeasurement::SetupWidgetWindow(){
|
||||
|
||||
/** Timer to update the progress bar **/
|
||||
progressTimer = new QTimer(this);
|
||||
//btnStartStop->setStyleSheet("color:green");
|
||||
/** Exp Time **/
|
||||
float time = (float)(myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1)*(1E-9));
|
||||
spinExpTime->setValue(time);
|
||||
comboExpUnit->setCurrentIndex(qDefs::SECONDS);
|
||||
|
||||
/** Hide the error message **/
|
||||
lblNote->hide();
|
||||
|
||||
/** File Name **/
|
||||
dispFileName->setText(QString(myDet->getFileName().c_str()));
|
||||
/** File Index **/
|
||||
spinIndex->setValue(myDet->getFileIndex());
|
||||
/** only initially **/
|
||||
lblProgressIndex->setText(QString::number(myDet->getFileIndex()));
|
||||
/** only initially **/
|
||||
progressBar->setValue(0);
|
||||
|
||||
/** Enabling/Disabling depending on the detector type*/
|
||||
/** timing mode*/
|
||||
/** Get timing mode from detector*/
|
||||
slsDetectorDefs::externalCommunicationMode mode = myDet->setExternalCommunicationMode();
|
||||
/** To be able to index items on a combo box */
|
||||
QStandardItemModel* model = qobject_cast<QStandardItemModel*>(comboTimingMode->model());
|
||||
QModelIndex index[NumTimingModes];
|
||||
QStandardItem* item[NumTimingModes];
|
||||
@ -73,7 +75,7 @@ void qTabMeasurement::SetupWidgetWindow(){
|
||||
index[i] = model->index(i, comboTimingMode->modelColumn(), comboTimingMode->rootModelIndex());
|
||||
item[i] = model->itemFromIndex(index[i]);
|
||||
}
|
||||
|
||||
/** Enabling/Disabling depending on the detector type */
|
||||
switch(myDet->getDetectorsType()){
|
||||
case slsDetectorDefs::MYTHEN:
|
||||
item[(int)Trigger_Exp_Series]->setEnabled(true);
|
||||
@ -83,7 +85,7 @@ void qTabMeasurement::SetupWidgetWindow(){
|
||||
item[(int)Gated_Start]->setEnabled(true);
|
||||
item[(int)Trigger_Window]->setEnabled(false);
|
||||
break;
|
||||
case slsDetectorDefs::EIGER:
|
||||
case slsDetectorDefs::GOTTHARD:
|
||||
item[(int)Trigger_Exp_Series]->setEnabled(true);
|
||||
item[(int)Trigger_Frame]->setEnabled(true);
|
||||
item[(int)Trigger_Readout]->setEnabled(false);
|
||||
@ -91,7 +93,7 @@ void qTabMeasurement::SetupWidgetWindow(){
|
||||
item[(int)Gated_Start]->setEnabled(false);
|
||||
item[(int)Trigger_Window]->setEnabled(true);
|
||||
break;
|
||||
case slsDetectorDefs::GOTTHARD:
|
||||
case slsDetectorDefs::EIGER:
|
||||
item[(int)Trigger_Exp_Series]->setEnabled(true);
|
||||
item[(int)Trigger_Frame]->setEnabled(false);
|
||||
item[(int)Trigger_Readout]->setEnabled(false);
|
||||
@ -100,18 +102,48 @@ void qTabMeasurement::SetupWidgetWindow(){
|
||||
item[(int)Trigger_Window]->setEnabled(false);
|
||||
break;
|
||||
default:
|
||||
cout<<"ERROR: Detector Type is Generic"<<endl;
|
||||
qDefs::ErrorMessage("ERROR: Unknown detector type.","Measurement: ERROR");
|
||||
exit(-1);
|
||||
break;
|
||||
}
|
||||
/** Setting the timing mode */
|
||||
if(item[mode]->isEnabled()){
|
||||
/**if the timing mode is Auto and
|
||||
* number of Frames and number of triggers is 1,
|
||||
* then the timing mode is 'None'.
|
||||
* This is for the inexperienced user */
|
||||
if(mode==slsDetectorDefs::AUTO_TIMING){
|
||||
int frames = (int)myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,-1);
|
||||
int triggers = (int)myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,-1);
|
||||
if((frames==1)&&(triggers==1)){
|
||||
comboTimingMode->setCurrentIndex((int)None);
|
||||
setTimingMode((int)None);
|
||||
}else{
|
||||
comboTimingMode->setCurrentIndex((int)Auto);
|
||||
setTimingMode((int)Auto);
|
||||
}
|
||||
}else{
|
||||
/** mode +1 since the detector class has no timingmode as "None" */
|
||||
comboTimingMode->setCurrentIndex((int)mode+1);
|
||||
setTimingMode((int)mode+1);
|
||||
}
|
||||
}
|
||||
/** Mode NOT ENABLED.
|
||||
* This should not happen only if the server and gui has a mismatch
|
||||
* on which all modes are allowed in detectors */
|
||||
else{
|
||||
qDefs::ErrorMessage("ERROR: Unknown Timing Mode detected from detector."
|
||||
"\n\nSetting the following defaults:\nTiming Mode \t: None\n"
|
||||
"Number of Frames \t: 1\nNumber of Triggers \t: 1","Measurement: WARNING");
|
||||
setNumFrames(1);
|
||||
setNumTriggers(1);
|
||||
comboTimingMode->setCurrentIndex((int)None);
|
||||
setTimingMode((int)None);
|
||||
}
|
||||
}
|
||||
|
||||
progressBar->setValue(0);
|
||||
//get timing mode from client
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qTabMeasurement::Initialization(int timingChange){
|
||||
/** These signals are connected only at start up*/
|
||||
@ -149,9 +181,7 @@ void qTabMeasurement::Initialization(int timingChange){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qTabMeasurement::DeInitialization(){
|
||||
/** Number of Frames**/
|
||||
@ -173,9 +203,7 @@ void qTabMeasurement::DeInitialization(){
|
||||
disconnect(spinNumProbes,SIGNAL(valueChanged(int)), this, SLOT(setNumProbes(int)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qTabMeasurement::Enable(bool enable){
|
||||
frameTimeResolved->setEnabled(enable);
|
||||
@ -184,8 +212,7 @@ void qTabMeasurement::Enable(bool enable){
|
||||
if(!enable) btnStartStop->setEnabled(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qTabMeasurement::setFileName(const QString& fName){
|
||||
myDet->setFileName(fName.toAscii().data());
|
||||
@ -194,8 +221,7 @@ void qTabMeasurement::setFileName(const QString& fName){
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qTabMeasurement::setRunIndex(int index){
|
||||
myDet->setFileIndex(index);
|
||||
@ -205,7 +231,7 @@ void qTabMeasurement::setRunIndex(int index){
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qTabMeasurement::startStopAcquisition(){
|
||||
if(!btnStartStop->text().compare("Start")){
|
||||
@ -233,8 +259,7 @@ void qTabMeasurement::startStopAcquisition(){
|
||||
myPlot->StartStopDaqToggle();
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qTabMeasurement::UpdateFinished(){
|
||||
disconnect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition()));
|
||||
@ -247,17 +272,14 @@ void qTabMeasurement::UpdateFinished(){
|
||||
progressTimer->stop();
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qTabMeasurement::UpdateProgress(){
|
||||
progressBar->setValue(myPlot->GetProgress());
|
||||
lblProgressIndex->setText(QString::number(myDet->getFileIndex()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qTabMeasurement::setNumFrames(int val){
|
||||
myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,val);
|
||||
@ -267,6 +289,7 @@ void qTabMeasurement::setNumFrames(int val){
|
||||
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qTabMeasurement::setExposureTime(){
|
||||
int64_t exptimeNS;
|
||||
@ -293,7 +316,7 @@ void qTabMeasurement::setExposureTime(){
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qTabMeasurement::setAcquisitionPeriod(){
|
||||
int64_t acqtimeNS;
|
||||
@ -318,9 +341,7 @@ void qTabMeasurement::setAcquisitionPeriod(){
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qTabMeasurement::setNumTriggers(int val){
|
||||
myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,val);
|
||||
@ -329,8 +350,7 @@ void qTabMeasurement::setNumTriggers(int val){
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qTabMeasurement::setDelay(){
|
||||
int64_t exptimeNS;
|
||||
@ -342,8 +362,7 @@ void qTabMeasurement::setDelay(){
|
||||
myDet->setTimer(slsDetectorDefs::DELAY_AFTER_TRIGGER,exptimeNS);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qTabMeasurement::setNumGates(int val){
|
||||
myDet->setTimer(slsDetectorDefs::GATES_NUMBER,val);
|
||||
@ -352,8 +371,7 @@ void qTabMeasurement::setNumGates(int val){
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qTabMeasurement::setNumProbes(int val){
|
||||
myDet->setTimer(slsDetectorDefs::PROBES_NUMBER,val);
|
||||
@ -362,14 +380,12 @@ void qTabMeasurement::setNumProbes(int val){
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qTabMeasurement::setTimingMode(int mode){
|
||||
#ifdef VERBOSE
|
||||
cout<<"Setting Timing mode to " << comboTimingMode->currentText().toAscii().data()<<endl;
|
||||
#endif
|
||||
//need to send to client to set the timing mode
|
||||
|
||||
/** Default settings */
|
||||
lblNumFrames->setEnabled(false); spinNumFrames->setEnabled(false);
|
||||
lblExpTime->setEnabled(false); spinExpTime->setEnabled(false); comboExpUnit->setEnabled(false);
|
||||
@ -379,15 +395,21 @@ void qTabMeasurement::setTimingMode(int mode){
|
||||
lblNumGates->setEnabled(false); spinNumGates->setEnabled(false);
|
||||
lblNumProbes->setEnabled(false); spinNumProbes->setEnabled(false);
|
||||
|
||||
|
||||
bool success = false;
|
||||
switch(mode){
|
||||
case None:/** Exposure Time */
|
||||
lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true);
|
||||
setNumFrames(1);
|
||||
setNumTriggers(1);
|
||||
if(myDet->setExternalCommunicationMode(slsDetectorDefs::AUTO_TIMING)==slsDetectorDefs::AUTO_TIMING)
|
||||
success = true;
|
||||
break;
|
||||
case Auto:/** Number of Frames, Exposure Time, Acquisition Period */
|
||||
lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true);
|
||||
lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true);
|
||||
lblPeriod->setEnabled(true); spinPeriod->setEnabled(true); comboPeriodUnit->setEnabled(true);
|
||||
if(myDet->setExternalCommunicationMode(slsDetectorDefs::AUTO_TIMING)==slsDetectorDefs::AUTO_TIMING)
|
||||
success = true;
|
||||
break;
|
||||
case Trigger_Exp_Series:/** Number of Frames, Exposure Time, Acquisition Period, Number of Triggers, Delay */
|
||||
lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true);
|
||||
@ -395,20 +417,28 @@ void qTabMeasurement::setTimingMode(int mode){
|
||||
lblPeriod->setEnabled(true); spinPeriod->setEnabled(true); comboPeriodUnit->setEnabled(true);
|
||||
lblNumTriggers->setEnabled(true); spinNumTriggers->setEnabled(true);
|
||||
lblDelay->setEnabled(true); spinDelay->setEnabled(true); comboDelayUnit->setEnabled(true);
|
||||
if(myDet->setExternalCommunicationMode(slsDetectorDefs::TRIGGER_EXPOSURE)==slsDetectorDefs::TRIGGER_EXPOSURE)
|
||||
success = true;
|
||||
break;
|
||||
case Trigger_Frame:/** Exposure Time, Number of Triggers */
|
||||
lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true);
|
||||
lblNumTriggers->setEnabled(true); spinNumTriggers->setEnabled(true);
|
||||
if(myDet->setExternalCommunicationMode(slsDetectorDefs::TRIGGER_FRAME)==slsDetectorDefs::TRIGGER_FRAME)
|
||||
success = true;
|
||||
break;
|
||||
case Trigger_Readout:/** Number of Frames, Exposure Time, Acquisition Period, Delay */
|
||||
lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true);
|
||||
lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true);
|
||||
lblPeriod->setEnabled(true); spinPeriod->setEnabled(true); comboPeriodUnit->setEnabled(true);
|
||||
lblDelay->setEnabled(true); spinDelay->setEnabled(true); comboDelayUnit->setEnabled(true);
|
||||
if(myDet->setExternalCommunicationMode(slsDetectorDefs::TRIGGER_READOUT)==slsDetectorDefs::TRIGGER_READOUT)
|
||||
success = true;
|
||||
break;
|
||||
case Gated:/** Number of Frames, Number of Gates */
|
||||
lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true);
|
||||
lblNumGates->setEnabled(true); spinNumGates->setEnabled(true);
|
||||
if(myDet->setExternalCommunicationMode(slsDetectorDefs::GATE_FIX_NUMBER)==slsDetectorDefs::GATE_FIX_NUMBER)
|
||||
success = true;
|
||||
break;
|
||||
case Gated_Start:/** Number of Frames, Exposure Time, Acquisition Period, Number of Triggers, Number of Gates */
|
||||
lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true);
|
||||
@ -416,12 +446,21 @@ void qTabMeasurement::setTimingMode(int mode){
|
||||
lblPeriod->setEnabled(true); spinPeriod->setEnabled(true); comboPeriodUnit->setEnabled(true);
|
||||
lblNumTriggers->setEnabled(true); spinNumTriggers->setEnabled(true);
|
||||
lblNumGates->setEnabled(true); spinNumGates->setEnabled(true);
|
||||
if(myDet->setExternalCommunicationMode(slsDetectorDefs::GATE_WITH_START_TRIGGER)==slsDetectorDefs::GATE_WITH_START_TRIGGER)
|
||||
success = true;
|
||||
break;
|
||||
case Trigger_Window:/** Number of Triggers */
|
||||
lblNumTriggers->setEnabled(true); spinNumTriggers->setEnabled(true);
|
||||
if(myDet->setExternalCommunicationMode(slsDetectorDefs::TRIGGER_WINDOW)==slsDetectorDefs::TRIGGER_WINDOW)
|
||||
success = true;
|
||||
break;
|
||||
default:
|
||||
cout<<"ERROR: Timing mode being set to other should never happen"<<endl;
|
||||
qDefs::ErrorMessage("ERROR: Timing mode unknown to GUI","Measurement: ERROR");
|
||||
exit(-1);
|
||||
}
|
||||
if(!success){
|
||||
qDefs::ErrorMessage("ERROR: The detector timing mode could not be set.\n"
|
||||
"Please check the external flags","Measurement: ERROR");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
@ -527,3 +566,5 @@ void qTabMeasurement::setTimingMode(int mode){
|
||||
|
||||
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
Loading…
x
Reference in New Issue
Block a user