[WIP] fix double image - armHeigth

parent 44107b96
This diff is collapsed.
......@@ -42,6 +42,10 @@ struct stcAllocBuff {
WORD *limaAllocBufferPtr[PCO_MAX_NR_ALLOCATED_BUFFERS]; // buffer allocated by Lima
WORD *limaAllocBufferPtr1[PCO_MAX_NR_ALLOCATED_BUFFERS]; // buffer allocated by Lima
DWORD dwLimaAllocBufferSize[PCO_MAX_NR_ALLOCATED_BUFFERS]; // buffer allocated by Lima
int limaAllocBufferNr[PCO_MAX_NR_ALLOCATED_BUFFERS]; // buffer nr allocated by Lima
int limaAllocBufferNr1[PCO_MAX_NR_ALLOCATED_BUFFERS]; // buffer nr allocated by Lima
DWORD dwStatus[8]; // PCO_AddBufferEx status/error return
//HANDLE bufferAllocEvent[PCO_MAX_NR_ALLOCATED_BUFFERS];
......
......@@ -992,7 +992,7 @@ namespace lima
void _pco_GetFirmwareInfo(char *buf_in, int size_in, int &err);
const char *_sprintComment(const char *comment, const char *comment1 ="" , const char *comment2 ="" );
const char *_sprintComment(bool bAlways, const char *comment, const char *comment1 ="" , const char *comment2 ="" );
void _pco_ArmCamera(int &err);
void _pco_SetRecordStopEvent(WORD wRecordStopEventMode, DWORD dwRecordStopDelayImages, int &err);
......@@ -1036,6 +1036,8 @@ namespace lima
const char *_getCameraIdn();
void getCamerasFound(std::string &o_sn) ;
void getDoubleImageMode(int & val);
void setDoubleImageMode(int val);
}; // class camera
} // namespace pco
......
......@@ -92,8 +92,8 @@ namespace lima
//BufferCtrlObj* _getBufferCtrlObj() {return m_buffer;}
void setExposing(pcoAcqStatus exposing);
void setStarted(bool started);
bool getStarted() {return m_started;}
pcoAcqStatus getExposing() {return m_exposing;}
bool getStarted();
pcoAcqStatus getExposing();
int _getRequestStop(int &nrStop);
void _setRequestStop(int requestStop);
......
......@@ -24,77 +24,70 @@ namespace Pco
//--------------------------------------------------------
void getBytesPerPixel(unsigned int& pixbytes /Out/); // bytesPerPixel
void getAcqTimeoutRetry(int &val /Out/); // acqTimeoutRetry
void setAcqTimeoutRetry(int val);
void getAdc(int & adc /Out/); // adc
void setAdc(int val);
void getAdc(int & adc /Out/); // adc
void setAdc(int val);
void getAdcMax(int & adc /Out/); // adcMax
void getAdcMax(int & adc /Out/); // adcMax
void getClTransferParam(std::string &o_sn /Out/) ; // clXferPar
void getLastError(std::string &o_sn /Out/) ; // last error
void getTraceAcq(std::string &o_sn /Out/) ; // traceAcq
void getLastImgRecorded(unsigned long & img /Out/); // lastImgRecorded
void getLastImgAcquired(unsigned long & img /Out/); // lastImgAcquired
void getMaxNbImages(unsigned long & nr /Out/); // maxNbImages
void getBinningInfo(std::string &o_sn /Out/);
void getCocRunTime(double & coc /Out/); // CocRunTime
void getFrameRate(double & frameRate /Out/); // frameRate
void getBytesPerPixel(unsigned int& pixbytes /Out/); // bytesPerPixel
void getCamerasFound(std::string &o_sn /Out/) ;
void getCamInfo(std::string &o_sn /Out/) ; // camInfo
void getCameraName(std::string &o_sn /Out/);
void getCameraNameBase(std::string &o_sn /Out/);
void getCameraNameEx(std::string &o_sn /Out/) ;
void getCamType(std::string &o_sn /Out/) ; // camType
void getVersion(std::string &o_sn /Out/) ; // version
void getCDIMode(int & val /Out/); // cdiMode
void setCDIMode(int val);
void getClTransferParam(std::string &o_sn /Out/) ; // clXferPar
void getCocRunTime(double & coc /Out/); // CocRunTime
void getCoolingTemperature(int & val /Out/);
void setCoolingTemperature(int val);
void getDoubleImageMode(int & val /Out/);
void setDoubleImageMode(int val);
void getFirmwareInfo(std::string &o_sn /Out/);
void getFrameRate(double & frameRate /Out/); // frameRate
void getPcoLogsEnabled(int & enabled /Out/); // pcoLogsEnabled
void getLastError(std::string &o_sn /Out/) ; // last error
void getLastImgAcquired(unsigned long & img /Out/); // lastImgAcquired
void getLastImgRecorded(unsigned long & img /Out/); // lastImgRecorded
void getMsgLog(std::string &o_sn /Out/); // logMsg
void getPcoLogsEnabled(int & enabled /Out/); // logPcoEnabled
void getMaxNbImages(unsigned long & nr /Out/); // maxNbImages
void getPixelRate(int & val /Out/); // pixelRate
void setPixelRate(int val);
void getPixelRateValidValues(std::string &o_sn /Out/) ; // pixelRateValidValues
void getPixelRateInfo(std::string &o_sn /Out/) ; // pixelRateInfo
void getPixelRateValidValues(std::string &o_sn /Out/) ; // pixelRateValidValues
void getRoiInfo(std::string &o_sn /Out/);
void getLastFixedRoi(std::string &o_sn /Out/) ; // roiLastFixed
void getRollingShutter(int & val /Out/); // rollingShutter
void setRollingShutter(int val);
void getRollingShutterInfo(std::string &o_sn /Out/) ; // rollingShutterInfo
void getLastFixedRoi(std::string &o_sn /Out/) ; // lastFixedRoi
void getCDIMode(int & val /Out/); // cdiMode
void setCDIMode(int val);
void getTemperatureInfo(std::string &o_sn /Out/);
void getCoolingTemperature(int & val /Out/);
void setCoolingTemperature(int val);
void getSdkRelease(std::string &o_sn /Out/) ;
void getCameraName(std::string &o_sn /Out/);
void getCameraNameBase(std::string &o_sn /Out/);
void getCameraNameEx(std::string &o_sn /Out/) ;
void getBinningInfo(std::string &o_sn /Out/);
void getFirmwareInfo(std::string &o_sn /Out/);
void getRoiInfo(std::string &o_sn /Out/);
void getMsgLog(std::string &o_sn /Out/);
void getTraceAcq(std::string &o_sn /Out/) ; // traceAcq
void getCamerasFound(std::string &o_sn /Out/) ;
void getVersion(std::string &o_sn /Out/) ; // version
void getSdkRelease(std::string &o_sn /Out/) ; // versionSdk
};
};
......
This diff is collapsed.
......@@ -362,7 +362,7 @@ void Camera::paramsInit(const char *str)
DEF_FNID;
DEB_CONSTRUCTOR();
DEB_TRACE() << _sprintComment(fnId, "[ENTRY]")
DEB_TRACE() << _sprintComment(false, fnId, "[ENTRY]")
<< DEB_VAR1(str);
int i;
......@@ -417,7 +417,7 @@ void Camera::paramsInit(const char *str)
value = m_pcoData->params.ptrValue[j];
DEB_TRACE() << DEB_VAR2(key, value);
}
DEB_TRACE() << _sprintComment(fnId, "[EXIT]");
DEB_TRACE() << _sprintComment(false, fnId, "[EXIT]");
};
//=========================================================================================================
......@@ -501,7 +501,7 @@ void Camera::_init(){
DEB_CONSTRUCTOR();
DEF_FNID;
DEB_ALWAYS() << _sprintComment(fnId, "[ENTRY]");
DEB_ALWAYS() << _sprintComment(false, fnId, "[ENTRY]");
char msg[MSG4K + 1];
//char *pMsg;
......@@ -639,7 +639,7 @@ void Camera::_init(){
DEB_TRACE() << m_log;
DEB_TRACE() << "END OF CAMERA";
DEB_ALWAYS() << _sprintComment(fnId, "[EXIT]");
DEB_ALWAYS() << _sprintComment(false, fnId, "[EXIT]");
}
......@@ -806,7 +806,7 @@ void Camera::prepareAcq()
DEB_MEMBER_FUNCT();
DEF_FNID;
DEB_ALWAYS() << _sprintComment(fnId, "[ENTRY]") << _checkLogFiles();
DEB_ALWAYS() << _sprintComment(false, fnId, "[ENTRY]") << _checkLogFiles();
int error;
......@@ -1010,9 +1010,11 @@ void Camera::prepareAcq()
}
#endif
#if 0
unsigned long ulFramesMaxInSegment = _pco_GetNumberOfImagesInSegment_MaxCalc(m_pcoData->wActiveRamSegment);
unsigned long ulRequestedFrames = (unsigned long) iRequestedFrames;
if(ulFramesMaxInSegment > 0)
{
WORD wDoubleImage;
......@@ -1045,6 +1047,10 @@ void Camera::prepareAcq()
return;
}
}
#endif
//------------------------------------------------- checking nr of frames for cams with memory
#endif
......@@ -1070,7 +1076,7 @@ void Camera::startAcq()
DEF_FNID;
HANDLE hEvent= NULL;
DEB_ALWAYS() << _sprintComment(fnId, "[ENTRY]") << _checkLogFiles();
DEB_ALWAYS() << _sprintComment(false, fnId, "[ENTRY]") << _checkLogFiles();
int error;
......@@ -1083,6 +1089,40 @@ void Camera::startAcq()
//m_sync->setExposing(pcoAcqRecordStart);
m_sync->setExposing(pcoAcqStart);
int iRequestedFrames;
m_sync->getNbFrames(iRequestedFrames);
unsigned long ulFramesMaxInSegment = _pco_GetNumberOfImagesInSegment_MaxCalc(m_pcoData->wActiveRamSegment);
unsigned long ulRequestedFrames = (unsigned long) iRequestedFrames;
if(ulRequestedFrames > 0)
{
WORD wDoubleImage;
int err;
// Double Image -> requested images will be the total nr of images (basic + primary)
// must be even and twice of the nr of images for pco
_pco_GetDoubleImageMode(wDoubleImage, err);
bool bOutOfRange = false;
if( (wDoubleImage) && ((ulRequestedFrames % 2) != 0) ) bOutOfRange = true;
if((ulFramesMaxInSegment >0) && (ulRequestedFrames > ulFramesMaxInSegment)) bOutOfRange = true;
if(bOutOfRange)
{
DEB_ALWAYS() << "\nERROR frames OUT OF RANGE " << DEB_VAR3(ulRequestedFrames, ulFramesMaxInSegment, wDoubleImage);
{
Event *ev = new Event(Hardware,Event::Error,Event::Camera,Event::CamNoMemory, "ERROR frames OUT OF RANGE");
_getPcoHwEventCtrlObj()->reportEvent(ev);
}
m_sync->setStarted(false);
m_sync->setExposing(pcoAcqError);
return;
}
}
if(!_isRunAfterAssign())
{
......@@ -1190,6 +1230,9 @@ void _pco_acq_thread_dimax(void *argin) {
sprintf_s(_msg, LEN_MSG, "%s> [ENTRY]", fnId);
m_cam->_traceMsg(_msg);
m_cam->_sprintComment(true, fnId, "[ENTRY]");
struct stcPcoData *m_pcoData = m_cam->_getPcoData();
m_pcoData->traceAcq.fnId = fnId;
......@@ -1337,7 +1380,14 @@ void _pco_acq_thread_dimax(void *argin) {
if(m_pcoData->testCmdMode & TESTCMDMODE_DIMAX_XFERMULTI) {
status = (pcoAcqStatus) m_buffer->_xferImag();
} else {
status = (pcoAcqStatus) m_buffer->_xferImagMult(); // <------------- default pco2k/4k NO waitobj
if(wDoubleImage)
{
status = (pcoAcqStatus) m_buffer->_xferImagDoubleImage(); // <------------- default dimax YES waitobj
}
else
{
status = (pcoAcqStatus) m_buffer->_xferImagMult(); // <------------- default pco2k/4k NO waitobj
}
}
}else{
if(m_pcoData->testCmdMode & TESTCMDMODE_DIMAX_XFERMULTI) {
......@@ -1421,6 +1471,8 @@ void _pco_acq_thread_dimax_trig_single(void *argin) {
struct stcPcoData *m_pcoData = m_cam->_getPcoData();
m_pcoData->traceAcq.fnId = fnId;
m_cam->_sprintComment(true, fnId, "[ENTRY]");
const char *msg;
TIME_USEC tStart, tStart0;
msElapsedTimeSet(tStart);
......@@ -1648,6 +1700,7 @@ void _pco_acq_thread_edge(void *argin) {
sprintf_s(_msg, LEN_MSG, "%s> [ENTRY]", fnId);
m_cam->_traceMsg(_msg);
m_cam->_sprintComment(true, fnId, "[ENTRY]");
struct stcPcoData *m_pcoData = m_cam->_getPcoData();
......@@ -1734,6 +1787,8 @@ void _pco_acq_thread_dimax_live(void *argin) {
long msXfer;
int requestStop = stopNone;
m_cam->_sprintComment(true, fnId, "[ENTRY]");
HANDLE m_handle = m_cam->getHandle();
m_sync->setAcqFrames(0);
......@@ -1777,6 +1832,8 @@ void _pco_acq_thread_ringBuffer(void *argin) {
sprintf_s(_msg, LEN_MSG, "%s> [ENTRY]", fnId);
m_cam->_traceMsg(_msg);
m_cam->_sprintComment(true, fnId, "[ENTRY]");
struct stcPcoData *m_pcoData = m_cam->_getPcoData();
TIME_USEC tStart;
......@@ -2630,6 +2687,7 @@ void _pco_shutter_thread_edge(void *argin) {
sprintf_s(_msg, LEN_MSG, "%s> [ENTRY]", fnId);
m_cam->_traceMsg(_msg);
m_cam->_sprintComment(true, fnId, "[ENTRY]");
m_cam->_pco_set_shutter_rolling_edge(error);
......
......@@ -671,6 +671,7 @@ void Camera::_pco_GetCDIMode(WORD &wCDIMode, int &err)
{
wCDIMode = 0;
err = 1;
DEB_TRACE() << "WARNING / CDI mode is NOT ALLOWED!";
return;
}
......@@ -702,6 +703,7 @@ void Camera::_pco_SetCDIMode(WORD wCDIMode, int &err)
if(!_isCapsDesc(capsCDI))
{
err = 1;
DEB_TRACE() << "WARNING / CDI mode is NOT ALLOWED!";
return;
}
......
......@@ -1669,7 +1669,7 @@ used to select a different signal, e.g. Status Busy or Status Exposure.
if(_stricmp(cmd, key) == 0){
char *comment = str_trim(cmdBuffAux + strlen(cmd));
ptr += sprintf_s(ptr, ptrMax - ptr, _sprintComment(comment) );
ptr += sprintf_s(ptr, ptrMax - ptr, _sprintComment(false, comment) );
DEB_TRACE() << output ;
return output;
......@@ -2677,8 +2677,10 @@ void Camera::_traceMsg(char *msg)
//====================================================================
//====================================================================
#define LEN_COMMENT 511
const char * Camera::_sprintComment(const char *comment, const char *comment1, const char *comment2)
const char * Camera::_sprintComment(bool bAlways, const char *comment, const char *comment1, const char *comment2)
{
DEB_MEMBER_FUNCT();
static char buff[LEN_COMMENT+1];
// "\n=================================================\n--- %s %s %s %s\n",
......@@ -2690,6 +2692,11 @@ const char * Camera::_sprintComment(const char *comment, const char *comment1, c
"\n--- %s %s %s %s\n",
getTimestamp(Iso), comment, comment1, comment2);
if(bAlways)
{
DEB_ALWAYS() << buff;
}
return buff ;
}
......@@ -3530,3 +3537,24 @@ void Camera::getCamerasFound(std::string &o_sn)
o_sn = buff;
}
//====================================================================
// SIP - attrib
//====================================================================
void Camera::getDoubleImageMode(int &mode)
{
int error;
WORD wMode;
_pco_GetDoubleImageMode(wMode, error);
mode = error ? -1 : wMode;
}
void Camera::setDoubleImageMode(int mode)
{
int error;
WORD wMode = (WORD) mode;
_pco_SetDoubleImageMode(wMode, error);
}
......@@ -119,7 +119,7 @@ void Interface::prepareAcq()
DEB_MEMBER_FUNCT();
DEF_FNID;
DEB_ALWAYS() << m_cam->_sprintComment(fnId, "[ENTRY]");
DEB_ALWAYS() << m_cam->_sprintComment(false, fnId, "[ENTRY]");
m_cam->_setActionTimestamp(tsPrepareAcq);
......@@ -138,7 +138,7 @@ void Interface::startAcq()
DEB_MEMBER_FUNCT();
DEF_FNID;
DEB_ALWAYS() << m_cam->_sprintComment(fnId, "[ENTRY]");
DEB_ALWAYS() << m_cam->_sprintComment(false, fnId, "[ENTRY]");
m_cam->_setActionTimestamp(tsStartAcq);
......@@ -154,7 +154,7 @@ void Interface::stopAcq()
DEB_MEMBER_FUNCT();
DEF_FNID;
DEB_ALWAYS() << m_cam->_sprintComment(fnId, "[ENTRY]");
DEB_ALWAYS() << m_cam->_sprintComment(false, fnId, "[ENTRY]");
m_cam->_setActionTimestamp(tsStopAcq);
m_sync->stopAcq();
......@@ -202,7 +202,7 @@ void Interface::getStatus(StatusType& status)
#endif
DEB_RETURN() << DEB_VAR1(status);
//DEB_RETURN() << DEB_VAR1(status);
}
//=========================================================================================================
......
......@@ -460,7 +460,7 @@ void SyncCtrlObj::startAcq()
bool _started = getStarted();
DEB_ALWAYS() << m_cam->_sprintComment(fnId, "[ENTRY]");
DEB_ALWAYS() << m_cam->_sprintComment(false, fnId, "[ENTRY]");
DEB_TRACE() << ": SyncCtrlObj::startAcq() " << DEB_VAR1(_started);
......@@ -474,6 +474,11 @@ void SyncCtrlObj::startAcq()
_setRequestStop(stopNone);
setExposing(pcoAcqStart);
m_cam->startAcq();
if(getExposing() == pcoAcqError)
{
setStarted(false);
return;
}
AutoMutex lock(m_cond.mutex());
......@@ -497,7 +502,8 @@ void SyncCtrlObj::startAcq()
//=========================================================================================================
//=========================================================================================================
void SyncCtrlObj::setExposing(pcoAcqStatus exposing) {
void SyncCtrlObj::setExposing(pcoAcqStatus exposing)
{
DEB_MEMBER_FUNCT();
DEF_FNID;
......@@ -507,13 +513,27 @@ void SyncCtrlObj::setExposing(pcoAcqStatus exposing) {
m_exposing = exposing;
m_cond.broadcast();
DEB_TRACE() << fnId << "[exit]" << ": " << DEB_VAR2(m_exposing, exposing);
DEB_TRACE() << DEB_VAR2(m_exposing, exposing);
}
//=========================================================================================================
//=========================================================================================================
pcoAcqStatus SyncCtrlObj::getExposing()
{
DEB_MEMBER_FUNCT();
DEF_FNID;
DEB_TRACE() << DEB_VAR1(m_exposing);
return m_exposing;
}
//=========================================================================================================
//=========================================================================================================
void SyncCtrlObj::setStarted(bool started) {
void SyncCtrlObj::setStarted(bool started)
{
DEB_MEMBER_FUNCT();
DEF_FNID;
......@@ -523,9 +543,25 @@ void SyncCtrlObj::setStarted(bool started) {
m_started = started;
m_cond.broadcast();
DEB_TRACE() << fnId << "[exit]" << ": " << DEB_VAR2(m_started, started);
DEB_TRACE() << DEB_VAR2(m_started, started);
}
//=========================================================================================================
//=========================================================================================================
bool SyncCtrlObj::getStarted()
{
DEB_MEMBER_FUNCT();
DEF_FNID;
DEB_TRACE() << DEB_VAR1(m_started);
return m_started;
}
//=========================================================================================================
//=========================================================================================================
void SyncCtrlObj::stopAcq(bool clearQueue)
......@@ -540,12 +576,13 @@ void SyncCtrlObj::stopAcq(bool clearQueue)
AutoMutex lock(m_cond.mutex());
DEB_ALWAYS() << m_cam->_sprintComment(fnId, "[ENTRY]");
DEB_ALWAYS() << m_cam->_sprintComment(false, fnId, "[ENTRY]");
_stopRequestIn = _getRequestStop(_nrStop);
while( (_started = getStarted()) )
{
DEB_TRACE() << "[while]" << DEB_VAR1(_started);
_setRequestStop(stopRequest);
resWait = m_cond.wait(5.);
}
......
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