Commit 3bc514e2 authored by ahoms's avatar ahoms
Browse files

SP+AH:

* added SPS live image display support in the Control layer 
  as a processlib SinkTask; available in PyFrelonDS through set/getMode
* included SPS in third-party
* fixed Frelon::Interface::reset to also stop the camera
* reading exp. time in Frelon::Camera::Sync to check if it's in ExtGate 


git-svn-id: https://scm.blissgarden.org/svn/lima/trunk@212 45c4679d-1946-429d-baad-37912b19538b
parent 24971726
......@@ -21,7 +21,8 @@ class FrelonAcq:
self.m_ct_saving = self.m_ct.saving()
self.m_ct_image = self.m_ct.image()
self.m_ct_buffer = self.m_ct.buffer()
self.m_ct_display = self.m_ct.display()
@DEB_MEMBER_FUNCT
def __del__(self):
......@@ -72,4 +73,5 @@ class FrelonAcq:
def getBufferControl(self):
return self.m_ct_buffer
def getDisplayControl(self):
return self.m_ct_display
......@@ -36,7 +36,10 @@ void Camera::sync()
int ser_nb;
getSerialNb(ser_nb);
m_trig_mode = IntTrig;
double exp_time;
getExpTime(exp_time);
m_trig_mode = (exp_time == 0) ? ExtGate : IntTrig;
readRegister(NbFrames, m_nb_frames);
m_roi_offset = 0;
......
......@@ -490,7 +490,7 @@ void Interface::reset(ResetLevel reset_level)
DEB_MEMBER_FUNCT();
DEB_PARAM() << DEB_VAR1(reset_level);
m_acq.stop();
stopAcq();
if (reset_level == HardReset) {
DEB_TRACE() << "Performing camera hard reset";
......
......@@ -17,6 +17,7 @@ CXXFLAGS = -I../include -I../../common/espia/include \
-I../../../control/software_operation/include/ \
-I../../../third-party/Processlib/core/include \
-I../../../third-party/Processlib/tasks/include \
-I../../../third-party/Sps/Include \
-I$(ESPIA_DRV_INCL) -Wall -pthread -g
test-progs = testfrelon testfreloninterface testfrelonspectroscopy \
......@@ -27,7 +28,7 @@ all: $(test-progs)
testfrelon: testfrelon.o $(frelon-objs)
$(CXX) $(LDFLAGS) -o $@ $+ $(LDLIBS)
testfreloninterface: testfreloninterface.o $(frelon-objs)
testfreloninterface: testfreloninterface.o $(frelon-objs) $(ct-objs)
$(CXX) $(LDFLAGS) -o $@ $+ $(LDLIBS)
testfrelonspectroscopy: testfrelonspectroscopy.o $(frelon-objs)
......
......@@ -3,6 +3,7 @@
#include "CtAcquisition.h"
#include "CtImage.h"
#include "CtSaving.h"
#include "CtSpsImage.h"
#include "AcqState.h"
using namespace lima;
......@@ -10,6 +11,10 @@ using namespace std;
DEB_GLOBAL(DebModTest);
//*********************************************************************
//* ImageStatusCallback
//*********************************************************************
class ImageStatusCallback : public CtControl::ImageStatusCallback
{
DEB_CLASS(DebModTest, "ImageStatusCallback");
......@@ -66,6 +71,11 @@ void ImageStatusCallback::imageStatusChanged(
}
}
//*********************************************************************
//* FrelonAcq
//*********************************************************************
class FrelonAcq
{
DEB_CLASS(DebModTest, "FrelonAcq");
......@@ -104,6 +114,7 @@ private:
CtSaving *m_ct_saving;
CtImage *m_ct_image;
CtBuffer *m_ct_buffer;
CtSpsImage *m_ct_display;
ImageStatusCallback *m_img_status_cb;
};
......@@ -122,10 +133,11 @@ FrelonAcq::FrelonAcq(int espia_dev_nb)
AutoPtr<CtControl> ct = new CtControl(&m_hw_inter);
m_ct_acq = ct->acquisition();
m_ct_saving = ct->saving();
m_ct_image = ct->image();
m_ct_buffer = ct->buffer();
m_ct_acq = ct->acquisition();
m_ct_saving = ct->saving();
m_ct_image = ct->image();
m_ct_buffer = ct->buffer();
m_ct_display = ct->display();
printDefaults();
......@@ -133,6 +145,9 @@ FrelonAcq::FrelonAcq(int espia_dev_nb)
img_status_cb = new ImageStatusCallback(*ct, m_acq_state);
ct->registerImageStatusCallback(*img_status_cb);
m_ct_display->setNames("_ccd_ds_", "frelon_live");
m_ct_display->setActive(true);
DEB_TRACE() << "All is OK!";
m_ct = ct.forget();
m_img_status_cb = img_status_cb.forget();
......@@ -221,7 +236,6 @@ void FrelonAcq::initSaving(string dir, string prefix, string suffix, int idx,
m_ct_saving->setFormat(fmt);
m_ct_saving->setSavingMode(mode);
m_ct_saving->setFramesPerFile(frames_per_file);
}
void FrelonAcq::setExpTime(double exp_time)
......@@ -257,6 +271,10 @@ void FrelonAcq::setRoi(Roi& roi)
}
//*********************************************************************
//* test_frelon_control
//*********************************************************************
void test_frelon_control(bool enable_debug = false)
{
DEB_GLOBAL_FUNCT();
......@@ -313,6 +331,11 @@ void test_frelon_control(bool enable_debug = false)
}
//*********************************************************************
//* main
//*********************************************************************
int main(int argc, char *argv[])
{
DEB_GLOBAL_FUNCT();
......
......@@ -75,6 +75,7 @@ class FrelonAcq:
self.m_ct_saving = self.m_ct.saving()
self.m_ct_image = self.m_ct.image()
self.m_ct_buffer = self.m_ct.buffer()
self.m_ct_display = self.m_ct.display()
self.m_use_events = use_events
self.m_print_time = print_time
......@@ -86,6 +87,10 @@ class FrelonAcq:
else:
self.m_poll_time = 0.1
self.m_ct_display.setNames('_ccd_ds_', 'frelon_live')
self.m_ct_display.setActive(True)
@DEB_MEMBER_FUNCT
def __del__(self):
if self.m_use_events:
......
......@@ -5,6 +5,7 @@
#include "TaskMgr.h"
#include "TaskEventCallback.h"
#include "SoftRoi.h"
#include "CtSpsImage.h"
#include "AcqState.h"
#include <iostream>
......@@ -25,8 +26,8 @@ class SoftRoiCallback : public TaskEventCallback
DEB_CLASS(DebModTest, "SoftRoiCallback");
public:
SoftRoiCallback(Frelon::Interface& hw_inter, BufferSave& buffer_save,
AcqState& acq_state);
SoftRoiCallback(Frelon::Interface& hw_inter, CtSpsImage& m_sps_image,
BufferSave& buffer_save, AcqState& acq_state);
~SoftRoiCallback();
virtual void finished(Data& data);
......@@ -35,15 +36,17 @@ private:
FrameDim& fdim);
Frelon::Interface& m_hw_inter;
CtSpsImage& m_sps_image;
BufferSave& m_buffer_save;
AcqState& m_acq_state;
};
SoftRoiCallback::SoftRoiCallback(Frelon::Interface& hw_inter,
CtSpsImage& sps_image,
BufferSave& buffer_save,
AcqState& acq_state)
: m_hw_inter(hw_inter), m_buffer_save(buffer_save),
m_acq_state(acq_state)
: m_hw_inter(hw_inter), m_sps_image(sps_image),
m_buffer_save(buffer_save), m_acq_state(acq_state)
{
DEB_CONSTRUCTOR();
}
......@@ -89,6 +92,8 @@ void SoftRoiCallback::finished(Data& data)
{
DEB_MEMBER_FUNCT();
m_sps_image.frameReady(data);
HwFrameInfoType finfo;
FrameDim fdim;
data2FrameInfo(data, finfo, fdim);
......@@ -114,7 +119,8 @@ class TestFrameCallback : public HwFrameCallback
public:
TestFrameCallback(Frelon::Interface& hw_inter, Roi& soft_roi,
BufferSave& buffer_save, AcqState& acq_state);
CtSpsImage& sps_image, BufferSave& buffer_save,
AcqState& acq_state);
~TestFrameCallback();
protected:
......@@ -130,12 +136,14 @@ private:
};
TestFrameCallback::TestFrameCallback(Frelon::Interface& hw_inter,
Roi& soft_roi, BufferSave& buffer_save,
Roi& soft_roi, CtSpsImage& sps_image,
BufferSave& buffer_save,
AcqState& acq_state)
: m_hw_inter(hw_inter), m_soft_roi(soft_roi)
{
DEB_CONSTRUCTOR();
m_roi_cb = new SoftRoiCallback(hw_inter, buffer_save, acq_state);
m_roi_cb = new SoftRoiCallback(hw_inter, sps_image, buffer_save,
acq_state);
m_roi_task = new SoftRoi();
}
......@@ -283,6 +291,36 @@ void set_hw_roi(HwRoiCtrlObj *hw_roi, const Roi& set_roi, Roi& real_roi,
}
//*********************************************************************
// check_sps_image_frame_dim
//*********************************************************************
void check_sps_image_frame_dim(HwInterface& hw_inter,
Bin& bin, Roi& set_roi, CtSpsImage& sps_image)
{
DEB_GLOBAL_FUNCT();
Size size;
if (set_roi.isEmpty()) {
HwDetInfoCtrlObj *hw_det_info;
hw_inter.getHwCtrlObj(hw_det_info);
hw_det_info->getMaxImageSize(size);
size /= bin;
} else {
size = set_roi.getSize();
}
HwBufferCtrlObj *hw_buffer;
hw_inter.getHwCtrlObj(hw_buffer);
FrameDim frame_dim;
hw_buffer->getFrameDim(frame_dim);
frame_dim.setSize(size);
DEB_TRACE() << DEB_VAR1(frame_dim);
sps_image.prepare(frame_dim);
}
//*********************************************************************
// print_deb_flags
//*********************************************************************
......@@ -334,11 +372,15 @@ void test_frelon_hw_inter(bool do_reset)
BufferSave buffer_save(BufferSave::EDF, "img", 0, ".edf", true, 1);
CtSpsImage sps_image;
sps_image.setNames("_ccd_ds_", "frelon_live");
MaxImageSizeCallback mis_cb;
Roi soft_roi;
AcqState acq_state;
TestFrameCallback cb(hw_inter, soft_roi, buffer_save, acq_state);
TestFrameCallback cb(hw_inter, soft_roi, sps_image, buffer_save,
acq_state);
HwDetInfoCtrlObj *hw_det_info;
hw_inter.getHwCtrlObj(hw_det_info);
......@@ -383,6 +425,7 @@ void test_frelon_hw_inter(bool do_reset)
hw_buffer->setFrameDim(effect_frame_dim);
hw_buffer->setNbBuffers(10);
hw_buffer->registerFrameCallback(cb);
check_sps_image_frame_dim(hw_inter, bin, set_roi, sps_image);
print_status(hw_inter);
acq_state.set(AcqState::Acquiring);
......@@ -435,6 +478,7 @@ void test_frelon_hw_inter(bool do_reset)
effect_frame_dim = frame_dim / bin;
hw_buffer->setFrameDim(effect_frame_dim);
hw_buffer->setNbBuffers(10);
check_sps_image_frame_dim(hw_inter, bin, set_roi, sps_image);
print_status(hw_inter);
acq_state.set(AcqState::Acquiring);
......@@ -450,6 +494,7 @@ void test_frelon_hw_inter(bool do_reset)
effect_frame_dim.setSize(real_roi.getSize());
hw_buffer->setFrameDim(effect_frame_dim);
hw_buffer->setNbBuffers(10);
check_sps_image_frame_dim(hw_inter, bin, set_roi, sps_image);
print_status(hw_inter);
acq_state.set(AcqState::Acquiring);
......@@ -468,6 +513,7 @@ void test_frelon_hw_inter(bool do_reset)
effect_frame_dim.setSize(real_roi.getSize());
hw_buffer->setFrameDim(effect_frame_dim);
hw_buffer->setNbBuffers(10);
check_sps_image_frame_dim(hw_inter, bin, set_roi, sps_image);
print_status(hw_inter);
acq_state.set(AcqState::Acquiring);
......@@ -481,6 +527,7 @@ void test_frelon_hw_inter(bool do_reset)
hw_buffer->setFrameDim(effect_frame_dim);
hw_buffer->setNbAccFrames(5);
hw_buffer->setNbBuffers(10);
check_sps_image_frame_dim(hw_inter, bin, set_roi, sps_image);
hw_sync->setNbFrames(3);
......
Supports Markdown
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