Commit 135d25c8 authored by Franck Cecillon's avatar Franck Cecillon
Browse files

mode 1D

parent 51d3f654
......@@ -64,7 +64,7 @@ enum
#define DEFAULT_TIME 0.1
#define DEFAULT_HEIGHT 2048
#define DEFAULT_WIDTH 2048
#define DEFAULT_WIDTH 2088
}
......
......@@ -48,7 +48,8 @@ IKonDriver::IKonDriver(const string& name) :
*/
height.init(this, SAVE, "height");
width.init(this, SAVE, "width");
bind.init(this, SAVE, "bind");
hbind.init(this, SAVE, "hbind");
vbind.init(this, SAVE, "vbind");
hflip.init(this, SAVE, "hflip");
vflip.init(this, SAVE, "vflip");
rotate.init(this, SAVE, "rotate");
......@@ -61,6 +62,9 @@ IKonDriver::IKonDriver(const string& name) :
hsspeed.init(this, SAVE, "hhspeed");
gain.init(this, SAVE, "gain");
bclamp.init(this, SAVE, "bclamp");
tempstatus.init(this, SAVE, "tempstatus");
modeFVB.init(this, SAVE, "modeFVB");;
vsspeed.init(this, SAVE, "vsspeed");
initCommand(driver::INIT_COMMAND);
initCommand(driver::READ_COMMAND);
......@@ -87,8 +91,8 @@ IKonDriver::IKonDriver(const string& name) :
m_SynchroniseReadTerminated = false;
m_DataShort = NULL;
registerObserverCommand(COMMAND_STATUS_DEVICE_CONTAINER, 50);
registerObserverCommand(COMMAND_READ_DEVICE_CONTAINER, 50);
registerObserverCommand(COMMAND_STATUS_DEVICE_CONTAINER, 10);
registerObserverCommand(COMMAND_READ_DEVICE_CONTAINER, 100);
registerSpyCommand(COMMAND_READ_DEVICE_CONTAINER, 5);
}
......
......@@ -78,7 +78,8 @@ public:
Property<int32> vflip;
Property<int32> acqmode;
Property<int32> bind;
Property<int32> hbind;
Property<int32> vbind;
Property<int32> rotate;
Property<int32> cooling;
Property<int32> readout;
......@@ -90,8 +91,9 @@ public:
Property<int32> gain;
Property<int32> tempstatus;
Property<bool > modeFVB;
Property<int32> vsspeed;
private:
......
......@@ -22,6 +22,10 @@
#include "IKonDriver.h"
#include "atmcdLXd.h"
#include "Utilities/Counter.h"
namespace ikon {
/*
......@@ -65,17 +69,19 @@ void RealIKonDriver::init() {
} else {
sleep(2); //sleep to allow initialization to complete
owner()->setpointTemperature=-80;
owner()->wantedTemperature=-80;
SetTemperature(-80);
CoolerON();
//Set Read Mode to --Image--
SetReadMode(AC_READMODE_SINGLETRACK);
// Full SetReadMode(0);
//Set Acquisition mode to --Single scan--
SetAcquisitionMode(AC_ACQMODE_SINGLE);
owner()->acqmode=AC_ACQMODE_SINGLE;
owner()->time.setpoint=DEFAULT_TIME;
owner()->readout=AC_READMODE_SINGLETRACK;
// Full owner()->readout=0;
//Set initial exposure time
SetExposureTime(DEFAULT_TIME);
//Initialize Shutter
......@@ -86,6 +92,7 @@ void RealIKonDriver::init() {
// Set active
SetBaselineClamp(1);
}
read();
......@@ -93,6 +100,12 @@ void RealIKonDriver::init() {
readStatus();
}
owner()->acqmode = 3;
writeParam();
owner()->acqmode = 1;
writeParam();
}
/*
......@@ -109,12 +122,19 @@ void RealIKonDriver::writeParam() {
int32 error;
int rc;
Counter c1;
rc =SetTemperature(owner()->setpointTemperature());
rc =SetTemperature(owner()->wantedTemperature());
if( rc != DRV_SUCCESS )
{
cout << "SetTemperature() error" << endl;
}else{
cout << "SetTemperature() to " <<owner()->wantedTemperature()<< endl;
}
cout << " writeParam0 SetTemperature " << c1.getTime() << endl;c1.clear();
//Set initial exposure time
rc =SetExposureTime( owner()->time.setpoint());
if( rc != DRV_SUCCESS )
......@@ -122,29 +142,64 @@ void RealIKonDriver::writeParam() {
cout << "SetExposureTime() error" << endl;
}
cout << " writeParam0 SetExposureTime " << c1.getTime() << endl;c1.clear();
owner()->width=DEFAULT_WIDTH;
owner()->height=DEFAULT_HEIGHT;
//rc =SetReadMode(0);
rc =SetReadMode(owner()->readout());
if( rc != DRV_SUCCESS )
{
cout << "SetReadMode() error" << endl;
}
cout << " writeParam0 SetReadMode " << c1.getTime() << endl;c1.clear();
//Setup Image dimensions
rc =SetImage(owner()->bind(),owner()->bind(),1,owner()->width(),1,owner()->height());
if( rc != DRV_SUCCESS )
{
cout << "SetImage() error" << endl;
}
rc =SetImageFlip( owner()->hflip(),owner()->vflip());
if( rc != DRV_SUCCESS )
{
cout << "SetImageFlip() error" << endl;
if (owner()->modeFVB() == false) {
SetAcquisitionMode(owner()->acqmode());
cout << " writeParam0 SetImage owner()->modeFVB() == false "<< endl;
rc = SetImage(owner()->hbind(), owner()->vbind(), 1, owner()->width(),1, owner()->height());
} else {
cout << " writeParam0 SetImage owner()->modeFVB() == true "<< endl;
rc = SetImage(1, 1, 1, owner()->width(), 1, 1);
}
rc =SetImageRotate(owner()->rotate());
// Sensor not oriented we switch X and Y
//rc =SetImage(owner()->vbind(),owner()->hbind(),1,owner()->width(),1,owner()->height());
// Full rc =SetImage(owner()->vbind(),1,1,owner()->width(),1,1);
// Test speed BOB
//rc =SetImage(100,1, 50,150, 1,2048);
// rc =SetImage(1,100, 1, 2048, 50,150);
// rc =SetImage(1,1, 1, 10, 1,10);
cout << " writeParam0 SetImage" << c1.getTime() << endl;c1.clear();
if( rc != DRV_SUCCESS )
{
cout << "SetImageRotate() error" << endl;
cout << "SetImage() error" << endl;
}
// Dont send SetImageFlip SetImageRotate
// rc =SetImageFlip( owner()->hflip(),owner()->vflip());
// if( rc != DRV_SUCCESS )
// {
// cout << "SetImageFlip() error" << endl;
// }
// rc =SetImageRotate(owner()->rotate());
// if( rc != DRV_SUCCESS )
// {
// cout << "SetImageRotate() error" << endl;
// }
rc =SetShutter(1,owner()->shutmode(),owner()->shutclosetime(),owner()->shutopentime());
if( rc != DRV_SUCCESS )
{
......@@ -186,7 +241,7 @@ void RealIKonDriver::writeParam() {
if (owner()->acqmode()==3){
rc = SetKineticCycleTime(owner()->time.setpoint()/(float64)owner()->nbSlicesAcq());
rc = SetKineticCycleTime(owner()->time.setpoint() + 0.001);
if( rc != DRV_SUCCESS )
{
cout << "SetKineticCycleTime() error" << endl;
......@@ -199,6 +254,9 @@ void RealIKonDriver::writeParam() {
}
}
cout << " writeParam0 other param " << c1.getTime() << endl;c1.clear();
}
/*
......@@ -207,6 +265,10 @@ void RealIKonDriver::writeParam() {
void RealIKonDriver::synchroniseRead() {
uint32 size;
cout << "RealIKonDriver synchroniseRead synchroniseRead synchroniseRead " << endl;
Counter c1;
/*
* Calculate the detector sum here
*/
......@@ -224,16 +286,29 @@ void RealIKonDriver::synchroniseRead() {
}
owner()->sum = sum;
owner()->data.sendEvent();
size= owner()->width()*owner()->height();
size=size/(owner()->bind()*owner()->bind());
if (owner()->modeFVB() == false) {
size = owner()->width() * owner()->height();
size = size / (owner()->hbind() * owner()->vbind());
} else {
size = DEFAULT_WIDTH;
}
if (owner()->acqmode()==3){
size=size*owner()->nbSlicesAcq();
}
// Test speed BOB
//size= 2088;
/* Finish the sequence */
cerr << "synchroniseReadRead " << endl;
cerr << "synchroniseReadRead01 size " << size << endl;
GetAcquiredData(data,size);
owner()->m_SynchroniseReadTerminated = true;
cout << "RealIKonDriver read Data " << c1.getTime() << endl;c1.clear();
}
/*
......@@ -241,8 +316,10 @@ void RealIKonDriver::synchroniseRead() {
*/
void RealIKonDriver::read() {
int32 temp;
GetTemperature(&temp);
int32 ret= GetTemperature(&temp);
owner()->actualTemperature=temp;
owner()->tempstatus=ret;
}
/*
......@@ -250,15 +327,33 @@ void RealIKonDriver::read() {
*/
void RealIKonDriver::start() {
Counter c1;
uint32 size;
int32 status;
int32 error;
float64 exp_time = owner()->time.setpoint();
clear();
size= owner()->width()*owner()->height();
size=size/(owner()->bind()*owner()->bind());
// Full SetReadMode(0);
//Set Acquisition mode to --Single scan--
//SetAcquisitionMode(AC_ACQMODE_SINGLE);
if (owner()->modeFVB() == false) {
size = owner()->width() * owner()->height();
size = size / (owner()->hbind() * owner()->vbind());
cout <<"owner()->modeFVB() == false acqmode " << owner()->acqmode() << endl;
SetAcquisitionMode(owner()->acqmode());
} else {
size = DEFAULT_WIDTH;
cout <<"owner()->modeFVB() == true acqmode 0 " << endl;
SetReadMode(0);
}
if (owner()->acqmode()==3){
exp_time=owner()->time.setpoint()/(float64)owner()->nbSlicesAcq();
exp_time=owner()->time.setpoint();
size=size*owner()->nbSlicesAcq();
}
int32* data = owner()->data();
......@@ -269,47 +364,71 @@ void RealIKonDriver::start() {
cout << "RealIKonDriver start01 " << c1.getTime() << endl;
at_32 acc, kin;
int stat;
do{
unsigned int ret = WaitForAcquisition();
cout << "RealIKonDriver start0100 " << c1.getTime() << endl;
if(ret==DRV_NO_NEW_DATA) {
AbortAcquisition();
cout << "RealIKonDriver start0101 " << c1.getTime() << endl;
cout << "DRV_NO_NEW_DATA" << endl;
owner()->startActivated = false;
owner()->commandProgression = PROGRESSION_END_DEVICE_CONTAINER;
break;
}
// usleep(10000);
GetAcquisitionProgress(&acc, &kin);
cout << "RealIKonDriver start0102 " << c1.getTime() << endl;
cout << "Accums=" << acc << " Kinetics=" << kin << endl;
GetStatus(&stat);
cout << "RealIKonDriver start0103 " << c1.getTime() << "Status " << stat << endl;
}while(stat==DRV_ACQUIRING);
cout << "RealIKonDriver start02 " << c1.getTime() << endl;
cout << " fin acc" << endl;
cout << " fin acc GetAcquiredData size " << size<< endl;
//BOB
//size= 2088;
error=GetAcquiredData(data,size);
if (error==DRV_SUCCESS) {
m_TimeCounter.clear();
} else {
cerr << "error acquisition1 " <<error<< endl;
}
int32 dataSize = owner()->dataSize();
cout << "dataSize " << dataSize << endl;
// if (data != NULL) {
// for (int32 i = 0; i < dataSize; ++i) {
// data[i] = data[i]-300;
// }
// } else {
// cerr << "error mask " << endl;
//
// }
//
// at_32* imageData = new at_32[size];
// error=GetAcquiredData(imageData,size);
// if (error==DRV_SUCCESS) {
// m_TimeCounter.clear();
// } else {
cerr << "fin acquisition22 " <<error<< endl;
//cerr << "fin acquisition22 " <<error<< endl;
// }
}
......@@ -352,6 +471,9 @@ void RealIKonDriver::readStatus() {
owner()->computeAcquisitionStatus(0);
owner()->computeDetectorStatus(0);
if (owner()->startActivated() == true) {
if ((value == DRV_IDLE) || (value ==DRV_DRIVER_ERRORS )) {
if (value == DRV_DRIVER_ERRORS) {
......@@ -359,7 +481,7 @@ void RealIKonDriver::readStatus() {
}
AbortAcquisition();
owner()->startActivated = false;
synchroniseRead();
//synchroniseRead();
owner()->time = owner()->time.setpoint();
owner()->commandProgression = PROGRESSION_END_DEVICE_CONTAINER;
} else {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment