Commit ef99b990 authored by Alejandro Homs Puron's avatar Alejandro Homs Puron Committed by operator for beamline

Support SPB8_F16_Dual:

* Include F16ForceSingle to also support a single SPB8
parent 5590fd76
Pipeline #8010 failed with stages
in 7 minutes and 1 second
......@@ -164,7 +164,7 @@ enum GeomType {
SPB12_4_Quad,
Hamamatsu,
SPB2_F16,
SPB8_F16_Half,
SPB8_F16_Single,
SPB8_F16_Dual,
};
......
......@@ -111,7 +111,7 @@ class Geometry : public HwMaxImageSizeCallbackGen
protected:
virtual void setMaxImageSizeCallbackActive(bool cb_active);
bool isFrelon16(SPBType spb_type);
bool isFrelon16();
void writeRegister(Reg reg, int val);
void readRegister (Reg reg, int& val);
......@@ -169,12 +169,9 @@ inline bool Geometry::isChanActive(InputChan curr, InputChan chan)
return (curr & chan) == chan;
};
inline bool Geometry::isFrelon16(SPBType spb_type)
inline bool Geometry::isFrelon16()
{
GeomType geom_type = m_model.getGeomType();
return (((geom_type == SPB2_F16) && (spb_type == SPBType2)) ||
(((geom_type == SPB8_F16_Half) ||
(geom_type == SPB8_F16_Dual)) && (spb_type == SPBType8)));
return (m_model.getChipType() == Andanta_CcdFT2k);
}
......
......@@ -126,7 +126,10 @@ class Model
void setCamChar(int cam_char);
void getCamChar(int& cam_char);
void setF16ForceSingle(bool f16_force_single);
void getF16ForceSingle(bool& f16_force_single);
void reset();
bool isValid();
......@@ -151,6 +154,7 @@ class Model
Firmware m_firmware;
int m_complex_ser_nb;
int m_cam_char;
bool m_f16_force_single;
bool m_valid;
SPBType m_spb_type;
......
......@@ -119,7 +119,11 @@ class FrelonAcq:
@DEB_MEMBER_FUNCT
def __init__(self, espia_dev_nb):
def __init__(self, espia_dev_nb, *args, **kws):
espia_dev_nb2 = kws.get('espia_dev_nb2', None)
if len(args) > 0:
espia_dev_nb2 = args[0]
self.m_cam_inited = False
self.m_e2v_corr = None
......@@ -129,11 +133,21 @@ class FrelonAcq:
self.m_bpm_mgr = Tasks.BpmManager()
self.m_bpm_task = Tasks.BpmTask(self.m_bpm_mgr)
self.m_edev = Espia.Dev(espia_dev_nb)
self.m_acq = Espia.Acq(self.m_edev)
self.m_buffer_cb_mgr = Espia.BufferMgr(self.m_acq)
self.m_eserline = Espia.SerialLine(self.m_edev)
self.m_ser_edev = Espia.Dev(espia_dev_nb)
self.m_eserline = Espia.SerialLine(self.m_ser_edev)
self.m_cam = Frelon.Camera(self.m_eserline)
self.m_acq_edev = self.m_ser_edev
model = self.m_cam.getModel()
f16 = (model.getChipType() == Frelon.Andanta_CcdFT2k)
if f16:
if espia_dev_nb2 is not None:
self.m_acq_edev = Espia.Meta([espia_dev_nb, espia_dev_nb2])
else:
model.setF16ForceSingle(True);
self.m_acq = Espia.Acq(self.m_acq_edev)
self.m_buffer_cb_mgr = Espia.BufferMgr(self.m_acq)
self.m_buffer_mgr = BufferCtrlMgr(self.m_buffer_cb_mgr)
self.m_hw_inter = Frelon.Interface(self.m_acq, self.m_buffer_mgr,
self.m_cam)
......@@ -158,7 +172,8 @@ class FrelonAcq:
del self.m_eserline; gc.collect()
del self.m_buffer_cb_mgr; gc.collect()
del self.m_acq; gc.collect()
del self.m_edev; gc.collect()
del self.m_acq_edev; gc.collect()
del self.m_ser_edev; gc.collect()
if self.m_e2v_corr:
del self.m_e2v_corr_update
......@@ -167,8 +182,11 @@ class FrelonAcq:
del self.m_bpm_task; gc.collect()
del self.m_bpm_mgr; gc.collect()
def getEspiaDev(self):
return self.m_edev
def getEspiaSerDev(self):
return self.m_ser_edev
def getEspiaAcqDev(self):
return self.m_acq_edev
def getEspiaAcq(self):
return self.m_acq
......
......@@ -171,7 +171,7 @@ enum GeomType {
SPB12_4_Quad,
Hamamatsu,
SPB2_F16,
SPB8_F16_Half,
SPB8_F16_Single,
SPB8_F16_Dual,
};
......
......@@ -78,6 +78,9 @@ class Model
void setCamChar(int cam_char);
void getCamChar(int& cam_char /Out/);
void setF16ForceSingle(bool f16_force_single);
void getF16ForceSingle(bool& f16_force_single /Out/);
void reset();
bool isValid();
......
......@@ -111,7 +111,7 @@ void Camera::syncRegs()
case SPB12_4_Quad:
case Hamamatsu:
case SPB2_F16:
case SPB8_F16_Half:
case SPB8_F16_Single:
case SPB8_F16_Dual:
m_geom = new Geometry(*this);
break;
......
......@@ -322,9 +322,10 @@ void Geometry::getMaxFrameDim(FrameDim& max_frame_dim)
ChipType chip_type = m_model.getChipType();
max_frame_dim = ChipMaxFrameDimMap[chip_type];
if (isFrelon16(SPBType2))
GeomType geom_type = m_model.getGeomType();
if (geom_type == SPB2_F16)
max_frame_dim /= Point(2, 2);
else if (isFrelon16(SPBType8))
else if (geom_type == SPB8_F16_Single)
max_frame_dim /= Point(1, 2);
DEB_RETURN() << DEB_VAR1(max_frame_dim);
......@@ -361,7 +362,7 @@ void Geometry::checkFlip(Flip& flip)
{
DEB_MEMBER_FUNCT();
DEB_PARAM() << DEB_VAR1(flip);
if (isFrelon16(SPBType2) || isFrelon16(SPBType8)) {
if (isFrelon16()) {
DEB_TRACE() << "No flip is supported";
flip = Flip(false);
} else {
......@@ -395,7 +396,7 @@ void Geometry::checkBin(Bin& bin)
DEB_MEMBER_FUNCT();
DEB_PARAM() << DEB_VAR1(bin);
bool frelon16 = (isFrelon16(SPBType2) || isFrelon16(SPBType8));
bool frelon16 = (isFrelon16());
int max_bin_x = frelon16 ? 1 : int(MaxBinX);
int max_bin_y = frelon16 ? 1 : int(MaxBinY);
int bin_x = min(bin.getX(), max_bin_x);
......@@ -494,7 +495,7 @@ Flip Geometry::getMirror()
Flip mirror;
mirror.x = isChanActive(curr, Chan12) || isChanActive(curr, Chan34);
mirror.y = isChanActive(curr, Chan13) || isChanActive(curr, Chan24);
if (isFrelon16(SPBType2) || isFrelon16(SPBType8))
if (isFrelon16())
mirror = Flip(false);
DEB_RETURN() << DEB_VAR1(mirror);
return mirror;
......@@ -935,7 +936,7 @@ void Geometry::getReadoutTime(double& readout_time)
THROW_HW_ERROR(NotSupported) << "Camera does not have "
<< "readout time calculation";
if (isFrelon16(SPBType2) || isFrelon16(SPBType8)) {
if (isFrelon16()) {
readout_time = 100e-3;
} else {
readFloatRegister(ReadoutTime, readout_time);
......@@ -951,7 +952,7 @@ void Geometry::getTransferTime(double& xfer_time)
THROW_HW_ERROR(NotSupported) << "Camera does not have "
<< "shift time calculation";
if (isFrelon16(SPBType2) || isFrelon16(SPBType8)) {
if (isFrelon16()) {
xfer_time = 100e-3;
} else {
readFloatRegister(TransferTime, xfer_time);
......
......@@ -811,6 +811,15 @@ Interface::Interface(Espia::Acq& acq, BufferCtrlMgr& buffer_mgr,
{
DEB_CONSTRUCTOR();
bool f16_dual = (m_cam.getModel().getGeomType() == SPB8_F16_Dual);
if (f16_dual != m_acq.getDev().isMeta())
THROW_HW_ERROR(Error) << "Frelon16 2xSPB8 / Espia mismatch";
Espia::SGImgConfig img_config = (f16_dual ? Espia::SGImgConcatVert2 :
Espia::SGImgNorm);
FrameDim det_frame_dim;
m_cam.getFrameDim(det_frame_dim);
m_acq.setSGImgConfig(img_config, det_frame_dim.getSize());
m_acq.registerAcqEndCallback(m_acq_end_cb);
m_acq.registerEventCallback(m_event_cb);
......
......@@ -139,6 +139,7 @@ void Firmware::checkValid()
}
Model::Model()
: m_f16_force_single(false)
{
DEB_CONSTRUCTOR();
......@@ -197,6 +198,22 @@ void Model::getCamChar(int& cam_char)
DEB_RETURN() << DEB_VAR1(DEB_HEX(cam_char));
}
void Model::setF16ForceSingle(bool f16_force_single)
{
DEB_MEMBER_FUNCT();
DEB_PARAM() << DEB_VAR1(f16_force_single);
m_f16_force_single = f16_force_single;
update();
}
void Model::getF16ForceSingle(bool& f16_force_single)
{
DEB_MEMBER_FUNCT();
f16_force_single = m_f16_force_single;
DEB_RETURN() << DEB_VAR1(f16_force_single);
}
void Model::reset()
{
DEB_MEMBER_FUNCT();
......@@ -204,6 +221,7 @@ void Model::reset()
m_firmware.reset();
m_complex_ser_nb = 0;
m_cam_char = 0;
update();
}
......@@ -251,6 +269,10 @@ void Model::update()
if (has(CamChar) && m_cam_char) {
int type_bits = (m_cam_char >> 8) & SPBConXY;
SPBConType spb_con_type = SPBConType(type_bits);
if ((spb_con_type == SPBConXY) && m_f16_force_single) {
DEB_TRACE() << "Limiting to single SPB8";
spb_con_type = SPBConX;
}
if (spb_con_type != SPBConNone)
m_spb_con_type = spb_con_type;
}
......@@ -367,7 +389,7 @@ GeomType Model::getGeomType()
THROW_HW_ERROR(Error) << "SPB8 only supports Frelon16";
SPBConType spb_con_type = getSPBConType();
bool dual_spb = (spb_con_type == SPBConXY);
geom_type = dual_spb ? SPB8_F16_Dual : SPB8_F16_Half;
geom_type = dual_spb ? SPB8_F16_Dual : SPB8_F16_Single;
}
DEB_RETURN() << DEB_VAR1(geom_type);
......
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