void
lima::Andor3::Interface::reset(ResetLevel reset_level)
{
  DEB_MEMBER_FUNCT();
  DEB_PARAM() << DEB_VAR1(reset_level);

  stopAcq();
  //#warning Should make sure that within finite time the camera returns to status Ready !!!
  // Should be done now...
}
Пример #2
0
//=====================================================================
//=====================================================================
//=================================================================================================
//=================================================================================================
void Camera::_set_shutter_rolling_edge(DWORD dwRolling, int &error)
{
		
	DEB_MEMBER_FUNCT();
	error = 0;

	if(!_isValid_rollingShutter(dwRolling)) 
	{
		DEB_ALWAYS() << "ERROR requested Rolling Shutter not allowed " << DEB_VAR1(dwRolling);
		error = -1;
		return;
	}

	m_pcoData->dwRollingShutter = dwRolling;

	DEB_TRACE() << "requested Rolling Shutter OK " << DEB_VAR1(dwRolling);

	_beginthread( _pco_shutter_thread_edge, 0, (void*) this);

	return;

}
Пример #3
0
//=================================================================================================
//=================================================================================================
void Camera::startAcq()
{
    DEB_MEMBER_FUNCT();

	m_acq_frame_nb = -1;
	m_pcoData->pcoError = 0;
	m_pcoData->pcoErrorMsg[0] = 0;

	m_pcoData->traceAcqClean();

	TIME_USEC tStart;
	msElapsedTimeSet(tStart);


//=====================================================================
	DEF_FNID;
    HANDLE hEvent= NULL;

	DEB_ALWAYS() << _sprintComment(false, fnId, "[ENTRY]") << _checkLogFiles();

	int error;


	//------------------------------------------------- start acquisition

	m_pcoData->traceAcq.msStartAcqStart = msElapsedTime(tStart);

	m_sync->setStarted(true);
	//m_sync->setExposing(pcoAcqRecordStart);
	m_sync->setExposing(pcoAcqStart);
	
    int iRequestedFrames;
    m_sync->getNbFrames(iRequestedFrames);


	int forced = 0;
	getRecorderForcedFifo(forced);

	int iPending;
	PCO_GetPendingBuffer(m_handle, &iPending);
	if(iPending < m_pco_buffer_nrevents)
	{
		PCO_CancelImages(m_handle);
		DEB_ALWAYS() << "PCO_CancelImages "<< DEB_VAR1(iPending);
	}


	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) ) 
		{
			DEB_ALWAYS() << "\nERROR odd nr of frames in DoubleImage";
			bOutOfRange = true;
		}
			
		if((ulFramesMaxInSegment > 0) && (ulRequestedFrames > ulFramesMaxInSegment) && (!forced) )
		{
			DEB_ALWAYS() << "\nERROR many frames in record mode";
			bOutOfRange = true;
		}

		if(bOutOfRange)
		{
			char msg[MSG1K];
			__sprintfSExt(msg, sizeof(msg)-1,
				"ERROR frames OUT OF RANGE ulRequestedFrames[%ld], ulFramesMaxInSegment[%ld], wDoubleImage[%d], forced[%d]",
				ulRequestedFrames, ulFramesMaxInSegment, wDoubleImage, forced);

			DEB_ALWAYS() << msg;
			m_sync->setStarted(false);
			m_sync->setExposing(pcoAcqError);

			throw LIMA_EXC(CameraPlugin, InvalidValue, msg);
			return;
		}
	}

	if(!_isRunAfterAssign())
	{
		DEB_TRACE() << "========================= recordingState 1 - BEFORE ASSIGN (startAcq)";
		_pco_SetRecordingState(1, error);
	}

	if(_isCameraType(Edge)){

		_beginthread( _pco_acq_thread_edge, 0, (void*) this);

#if 0
		AutoMutex lock(m_cond.mutex());

		bool resWait;
		int retry = 3;
		int val, val0; val0 = pcoAcqRecordStart;

		while( ((val =  m_sync->getExposing()) != val0) && retry--)
		{
			DEB_TRACE() << "+++ getExposing / pcoAcqRecordStart - WAIT - " << DEB_VAR3(val, val0, retry);
			resWait = m_cond.wait(2.);
		}
		DEB_TRACE() << "+++ getExposing / pcoAcqRecordStart - EXIT - " << DEB_VAR3(val, val0, retry);
		lock.unlock();
#endif

		m_pcoData->traceAcq.msStartAcqEnd = msElapsedTime(tStart);
		return;
	}

#if 0
	if(_isCameraType(Pco2k | Pco4k)){
		_beginthread( _pco_acq_thread_ringBuffer, 0, (void*) this);
		m_pcoData->traceAcq.msStartAcqEnd = msElapsedTime(tStart);
		return;
	}
#endif

	if(_isCameraType(Dimax | Pco2k | Pco4k)){
	    int iRequestedFrames;
		m_sync->getNbFrames(iRequestedFrames);

	    TrigMode trig_mode;
		m_sync->getTrigMode(trig_mode);
		_pco_SetRecordingState(1, error);

		int forcedFifo = 0;
		getRecorderForcedFifo(forcedFifo);

		if((iRequestedFrames > 0 ) && (forcedFifo == 0) ){
			if((trig_mode  == ExtTrigSingle) ) {
				_beginthread( _pco_acq_thread_dimax_trig_single, 0, (void*) this);
			} else {
				_beginthread( _pco_acq_thread_dimax, 0, (void*) this);	// normal mode
			}
		} else {
			_beginthread( _pco_acq_thread_dimax_live, 0, (void*) this);
		}
		m_pcoData->traceAcq.msStartAcqEnd = msElapsedTime(tStart);
		return;
	}

	throw LIMA_HW_EXC(Error, "unkown camera type");
	return;
}
Пример #4
0
Camera::Camera(const char *params) :
	m_cam_connected(false),
	m_acq_frame_nb(1),
	m_sync(NULL),
	m_buffer(NULL),
	m_handle(NULL),
	m_Roi_lastFixed_time(0),
	m_pco_buffer_nrevents(PCO_BUFFER_NREVENTS),
	bRecorderForcedFifo(false)
{
	DEF_FNID;
	DEB_CONSTRUCTOR();

	int error=0;
	m_config = TRUE;
	DebParams::checkInit();

	
	m_msgLog = new ringLog(300) ;
	m_tmpLog = new ringLog(300) ;
	if(m_msgLog == NULL)
		throw LIMA_HW_EXC(Error, "m_msgLog > creation error");
	if(m_tmpLog == NULL)
		throw LIMA_HW_EXC(Error, "m_tmpLog > creation error");

	m_pcoData =new stcPcoData();
	if(m_pcoData == NULL)
		throw LIMA_HW_EXC(Error, "m_pcoData > creation error");


	m_checkImgNr = new CheckImgNr(this);


	// properties: params 
	paramsInit(params);

	char *value;
	const char  *key;
	bool ret;
	int iValue;

	/***
	key = "test";
	key = "withConfig";
	key = "testMode";
	key = "debugPco";
	***/
	key = "testMode";
	ret = paramsGet(key, value);
	if(ret) {m_pcoData->testCmdMode = _atoi64(value);}

	key = "acqTimeoutRetry";
	ret = paramsGet(key, value);
	iValue = ret ? atoi(value) : 3;
	m_pcoData->acqTimeoutRetry = (iValue < 0 ) ? 0 : iValue;

	// patch in xMinSize meanwhile firmware for CLHS 1.19 is fixed
	key = "xMinSize";
	m_pcoData->params_xMinSize = !!paramsGet(key, value);

	// ignore the nbMaxImages calculated for dimax HS
	key = "ignoreMaxImages";
	m_pcoData->params_ignoreMaxImages = !!paramsGet(key, value);


	DEB_ALWAYS()
		<< ALWAYS_NL << DEB_VAR1(m_pcoData->version) 
		<< ALWAYS_NL << _checkLogFiles(true);

	//m_bin.changed = Invalid;
	
	_init();
	m_config = FALSE;
	_setActionTimestamp(tsConstructor);
}