Commit 1d9a54d1 authored by Alejandro Homs Puron's avatar Alejandro Homs Puron

* Force shutter mode to ShutterAutoFrame in Frelon::Interface::reset

* Added Frelon::E2VCorrection for compensating columns 1023,1024
  (currently a factor 2 is applied for easier validation).
* Created Frelon::Bin/RoiChangedCallback, used in E2VCorrectionUpdate to
  automatically set the hw parameters needed by the correction code.
* Moved Frelon control code from FrelonTacoAcq to FrelonAcq.
* Refactored LimaConvertor.h to simplify management of SIP ctrl objs.
  Macro 'domains' were defined to implement different interface classes:
  HwInterface (HW domain), Frelon::Interface (FRELON domain).
* Implemented SIP Frelon::Interface::getHwCtrlObj
* Fixed bug in CtControl::newFrameReady adding an empty TaskMgr to the
  process queue of the PoolThread.
* Added CtImage::setFlip to SIP interface
* Make Frelon::Camera::getInputChanModeName a static member function
* Removed extra Copyright/License header from:
  LimaConvertor.h, global.inc and espia.inc
parent b1c7069a
......@@ -60,8 +60,8 @@ class Camera : public HwMaxImageSizeCallbackGen
void setFrameTransferMode(FrameTransferMode ftm);
void getFrameTransferMode(FrameTransferMode& ftm);
std::string getInputChanModeName(FrameTransferMode ftm,
InputChan input_chan);
static std::string getInputChanModeName(FrameTransferMode ftm,
InputChan input_chan);
void getFrameDim(FrameDim& frame_dim);
......
......@@ -139,11 +139,9 @@ class SyncCtrlObj : public HwSyncCtrlObj
{
DEB_CLASS_NAMESPC(DebModCamera, "SyncCtrlObj::AcqEndCallback",
"Frelon");
public:
AcqEndCallback(Camera& cam);
virtual ~AcqEndCallback();
protected:
virtual void acqFinished(const HwFrameInfoType& /*finfo*/);
private:
......@@ -161,6 +159,25 @@ class SyncCtrlObj : public HwSyncCtrlObj
* \brief Control object providing Frelon binning interface
*******************************************************************/
class BinCtrlObj;
class BinChangedCallback
{
DEB_CLASS_NAMESPC(DebModCamera, "BinChangedCallback", "Frelon");
public:
BinChangedCallback();
virtual ~BinChangedCallback();
protected:
virtual void hwBinChanged(const Bin& hw_bin) = 0;
private:
friend class BinCtrlObj;
BinCtrlObj *m_bin_ctrl_obj;
};
class BinCtrlObj : public HwBinCtrlObj
{
DEB_CLASS_NAMESPC(DebModCamera, "BinCtrlObj", "Frelon");
......@@ -173,8 +190,12 @@ class BinCtrlObj : public HwBinCtrlObj
virtual void getBin(Bin& bin);
virtual void checkBin(Bin& bin);
void registerBinChangedCallback (BinChangedCallback& bin_chg_cb);
void unregisterBinChangedCallback(BinChangedCallback& bin_chg_cb);
private:
Camera& m_cam;
BinChangedCallback *m_bin_chg_cb;
};
......@@ -183,6 +204,25 @@ class BinCtrlObj : public HwBinCtrlObj
* \brief Control object providing Frelon Roi interface
*******************************************************************/
class RoiCtrlObj;
class RoiChangedCallback
{
DEB_CLASS_NAMESPC(DebModCamera, "RoiChangedCallback", "Frelon");
public:
RoiChangedCallback();
virtual ~RoiChangedCallback();
protected:
virtual void hwRoiChanged(const Roi& hw_roi) = 0;
private:
friend class RoiCtrlObj;
RoiCtrlObj *m_roi_ctrl_obj;
};
class RoiCtrlObj : public HwRoiCtrlObj
{
DEB_CLASS_NAMESPC(DebModCamera, "RoiCtrlObj", "Frelon");
......@@ -195,8 +235,12 @@ class RoiCtrlObj : public HwRoiCtrlObj
virtual void getRoi(Roi& hw_roi);
virtual void checkRoi(const Roi& set_roi, Roi& hw_roi);
void registerRoiChangedCallback (RoiChangedCallback& roi_chg_cb);
void unregisterRoiChangedCallback(RoiChangedCallback& roi_chg_cb);
private:
Camera& m_cam;
RoiChangedCallback *m_roi_chg_cb;
};
......
This diff is collapsed.
......@@ -55,8 +55,8 @@ class Camera
void setFrameTransferMode(Frelon::FrameTransferMode ftm);
void getFrameTransferMode(Frelon::FrameTransferMode& ftm /Out/);
std::string getInputChanModeName(Frelon::FrameTransferMode ftm,
Frelon::InputChan input_chan);
static std::string getInputChanModeName(Frelon::FrameTransferMode ftm,
Frelon::InputChan input_chan);
void getFrameDim(FrameDim& frame_dim /Out/);
......
......@@ -123,6 +123,23 @@ class SyncCtrlObj : HwSyncCtrlObj
};
class BinChangedCallback
{
%TypeHeaderCode
#include "FrelonInterface.h"
#include <algorithm>
%End
public:
BinChangedCallback();
virtual ~BinChangedCallback();
protected:
virtual void hwBinChanged(const Bin& hw_bin) = 0;
};
class BinCtrlObj : HwBinCtrlObj
{
......@@ -138,6 +155,26 @@ class BinCtrlObj : HwBinCtrlObj
virtual void setBin(const Bin& bin);
virtual void getBin(Bin& bin /Out/);
virtual void checkBin(Bin& bin /In,Out/);
void registerBinChangedCallback (Frelon::BinChangedCallback& chg_cb);
void unregisterBinChangedCallback(Frelon::BinChangedCallback& chg_cb);
};
class RoiChangedCallback
{
%TypeHeaderCode
#include "FrelonInterface.h"
#include <algorithm>
%End
public:
RoiChangedCallback();
virtual ~RoiChangedCallback();
protected:
virtual void hwRoiChanged(const Roi& hw_roi) = 0;
};
......@@ -156,6 +193,9 @@ class RoiCtrlObj : HwRoiCtrlObj
virtual void checkRoi(const Roi& set_roi, Roi& hw_roi /Out/);
virtual void setRoi(const Roi& set_roi);
virtual void getRoi(Roi& hw_roi /Out/);
void registerRoiChangedCallback (Frelon::RoiChangedCallback& chg_cb);
void unregisterRoiChangedCallback(Frelon::RoiChangedCallback& chg_cb);
};
......@@ -227,6 +267,19 @@ class Interface : HwInterface
virtual void stopAcq();
virtual void getStatus(HwInterface::StatusType& status /Out/);
virtual int getNbHwAcquiredFrames();
SIP_PYOBJECT getHwCtrlObj(HwCap::Type cap_type);
%MethodCode
HwInterface::CapList cap_list;
sipCpp->getCapList(cap_list);
typedef HwInterface::CapList::const_iterator It;
for (It i = cap_list.begin(); i != cap_list.end(); ++i)
if (i->getType() == a0) {
LIMA_CONVERT_HWCAP_TO_SIP_CTRLOBJ(i, FRELON);
break;
}
%End
};
......
......@@ -196,7 +196,7 @@ int Camera::getModesAvail()
string Camera::getInputChanModeName(FrameTransferMode ftm,
InputChan input_chan)
{
DEB_MEMBER_FUNCT();
DEB_STATIC_FUNCT();
ostringstream os;
os << ((ftm == FTM) ? "FTM" : "FFM") << "-";
......
......@@ -362,8 +362,21 @@ void SyncCtrlObj::AcqEndCallback::acqFinished(const HwFrameInfoType& /*finfo*/)
* \brief BinCtrlObj constructor
*******************************************************************/
BinChangedCallback::BinChangedCallback()
: m_bin_ctrl_obj(NULL)
{
DEB_CONSTRUCTOR();
}
BinChangedCallback::~BinChangedCallback()
{
DEB_DESTRUCTOR();
if (m_bin_ctrl_obj != NULL)
m_bin_ctrl_obj->unregisterBinChangedCallback(*this);
}
BinCtrlObj::BinCtrlObj(Camera& cam)
: m_cam(cam)
: m_cam(cam), m_bin_chg_cb(NULL)
{
DEB_CONSTRUCTOR();
}
......@@ -371,12 +384,21 @@ BinCtrlObj::BinCtrlObj(Camera& cam)
BinCtrlObj::~BinCtrlObj()
{
DEB_DESTRUCTOR();
if (m_bin_chg_cb)
m_bin_chg_cb->m_bin_ctrl_obj = NULL;
}
void BinCtrlObj::setBin(const Bin& bin)
{
DEB_MEMBER_FUNCT();
m_cam.setBin(bin);
if (m_bin_chg_cb) {
DEB_TRACE() << "Firing change callback";
Bin hw_bin;
getBin(hw_bin);
m_bin_chg_cb->hwBinChanged(hw_bin);
}
}
void BinCtrlObj::getBin(Bin& bin)
......@@ -391,13 +413,56 @@ void BinCtrlObj::checkBin(Bin& bin)
m_cam.checkBin(bin);
}
void BinCtrlObj::registerBinChangedCallback(BinChangedCallback& bin_chg_cb)
{
DEB_MEMBER_FUNCT();
DEB_PARAM() << DEB_VAR2(&bin_chg_cb, m_bin_chg_cb);
if (m_bin_chg_cb != NULL)
THROW_HW_ERROR(InvalidValue) << "a cb is already registered";
m_bin_chg_cb = &bin_chg_cb;
bin_chg_cb.m_bin_ctrl_obj = this;
DEB_TRACE() << "Firing first callback for update";
Bin hw_bin;
getBin(hw_bin);
m_bin_chg_cb->hwBinChanged(hw_bin);
}
void BinCtrlObj::unregisterBinChangedCallback(BinChangedCallback& bin_chg_cb)
{
DEB_MEMBER_FUNCT();
DEB_PARAM() << DEB_VAR2(&bin_chg_cb, m_bin_chg_cb);
if (&bin_chg_cb != m_bin_chg_cb)
THROW_HW_ERROR(InvalidValue) << "cb is not registered";
m_bin_chg_cb = NULL;
bin_chg_cb.m_bin_ctrl_obj = NULL;
}
/*******************************************************************
* \brief RoiCtrlObj constructor
*******************************************************************/
RoiChangedCallback::RoiChangedCallback()
: m_roi_ctrl_obj(NULL)
{
DEB_CONSTRUCTOR();
}
RoiChangedCallback::~RoiChangedCallback()
{
DEB_DESTRUCTOR();
if (m_roi_ctrl_obj != NULL)
m_roi_ctrl_obj->unregisterRoiChangedCallback(*this);
}
RoiCtrlObj::RoiCtrlObj(Camera& cam)
: m_cam(cam)
: m_cam(cam), m_roi_chg_cb(NULL)
{
DEB_CONSTRUCTOR();
}
......@@ -405,6 +470,9 @@ RoiCtrlObj::RoiCtrlObj(Camera& cam)
RoiCtrlObj::~RoiCtrlObj()
{
DEB_DESTRUCTOR();
if (m_roi_chg_cb)
m_roi_chg_cb->m_roi_ctrl_obj = NULL;
}
void RoiCtrlObj::checkRoi(const Roi& set_roi, Roi& hw_roi)
......@@ -417,6 +485,13 @@ void RoiCtrlObj::setRoi(const Roi& roi)
{
DEB_MEMBER_FUNCT();
m_cam.setRoi(roi);
if (m_roi_chg_cb) {
DEB_TRACE() << "Firing change callback";
Roi hw_roi;
getRoi(hw_roi);
m_roi_chg_cb->hwRoiChanged(hw_roi);
}
}
void RoiCtrlObj::getRoi(Roi& roi)
......@@ -425,6 +500,35 @@ void RoiCtrlObj::getRoi(Roi& roi)
m_cam.getRoi(roi);
}
void RoiCtrlObj::registerRoiChangedCallback(RoiChangedCallback& roi_chg_cb)
{
DEB_MEMBER_FUNCT();
DEB_PARAM() << DEB_VAR2(&roi_chg_cb, m_roi_chg_cb);
if (m_roi_chg_cb != NULL)
THROW_HW_ERROR(InvalidValue) << "a cb is already registered";
m_roi_chg_cb = &roi_chg_cb;
roi_chg_cb.m_roi_ctrl_obj = this;
DEB_TRACE() << "Firing first callback for update";
Roi hw_roi;
getRoi(hw_roi);
m_roi_chg_cb->hwRoiChanged(hw_roi);
}
void RoiCtrlObj::unregisterRoiChangedCallback(RoiChangedCallback& roi_chg_cb)
{
DEB_MEMBER_FUNCT();
DEB_PARAM() << DEB_VAR2(&roi_chg_cb, m_roi_chg_cb);
if (&roi_chg_cb != m_roi_chg_cb)
THROW_HW_ERROR(InvalidValue) << "cb is not registered";
m_roi_chg_cb = NULL;
roi_chg_cb.m_roi_ctrl_obj = NULL;
}
/*******************************************************************
* \brief FlipCtrlObj constructor
......@@ -511,7 +615,8 @@ void ShutterCtrlObj::setMode(ShutterMode shut_mode)
<< DEB_VAR1(shut_mode);
ShutMode cam_mode;
cam_mode = (shut_mode == ShutterAutoFrame) ? Frelon::AutoFrame : Frelon::Off;
cam_mode = (shut_mode == ShutterAutoFrame) ? Frelon::AutoFrame :
Frelon::Off;
m_cam.setShutMode(cam_mode);
}
......@@ -521,7 +626,8 @@ void ShutterCtrlObj::getMode(ShutterMode& shut_mode) const
ShutMode cam_mode;
m_cam.getShutMode(cam_mode);
shut_mode = (cam_mode == Frelon::AutoFrame) ? ShutterAutoFrame : ShutterManual;
shut_mode = (cam_mode == Frelon::AutoFrame) ? ShutterAutoFrame :
ShutterManual;
DEB_RETURN() << DEB_VAR1(shut_mode);
}
......@@ -653,7 +759,8 @@ void Interface::reset(ResetLevel reset_level)
m_sync.setLatTime(0.0);
m_sync.setTrigMode(IntTrig);
m_cam.setShutCloseTime(0.0);
m_shutter.setMode(ShutterAutoFrame);
m_shutter.setCloseTime(0.0);
m_bin.setBin(Bin(1));
m_roi.setRoi(Roi());
......
......@@ -23,12 +23,13 @@
include ../../common/espia/include/espia.inc
frelon-objs = FrelonBase.o FrelonSerialLine.o FrelonModel.o FrelonCamera.o \
FrelonTimingCtrl.o FrelonInterface.o
FrelonTimingCtrl.o FrelonInterface.o FrelonCorrection.o
SRCS = $(frelon-objs:.o=.cpp)
CXXFLAGS = -I../include -I../../common/espia/include \
-I../../../hardware/include -I../../../common/include \
-I../../../third-party/Processlib/core/include \
-I$(ESPIA_DRV_INCL) -Wall -pthread -fPIC -g
all: Frelon.o
......
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