Commit 601d4102 authored by Alejandro Homs Puron's avatar Alejandro Homs Puron
Browse files

[PSI] Add trigger_mode to acquisition_params

parent 40ae74b6
Pipeline #81193 passed with stages
in 13 minutes and 57 seconds
......@@ -257,18 +257,34 @@ void control::impl::hw_prepare(acq_params_t const& acq_params)
using namespace sls::FrameAssembler;
// Set acquisition parameters
m_det->setTimingMode(slsDetectorDefs::AUTO_TIMING);
slsDetectorDefs::timingMode timing_mode;
switch (acq_params.acq.trigger_mode) {
case trigger_mode_enum::software:
timing_mode = slsDetectorDefs::AUTO_TIMING;
break;
case trigger_mode_enum::external:
timing_mode = slsDetectorDefs::TRIGGER_EXPOSURE;
break;
case trigger_mode_enum::gate:
timing_mode = slsDetectorDefs::TRIGGER_GATED;
break;
}
int nb_frames = acq_params.acq.nb_frames;
int frames_per_trigger = acq_params.acq.nb_frames_per_trigger;
bool trigger_all_frames = (frames_per_trigger == acq_params.acq.all_frames);
if (!trigger_all_frames && (nb_frames % frames_per_trigger != 0))
throw lima::invalid_argument("Invalid nb_frames_per_trigger: " + std::to_string(frames_per_trigger));
m_det->setTimingMode(timing_mode);
m_det->setExptime(acq_params.acq.expo_time);
auto frame_period = acq_params.acq.expo_time + acq_params.acq.latency_time;
m_det->setPeriod(frame_period);
bool trig_exp = false;
int nb_frames = acq_params.acq.nb_frames;
int cam_frames = trig_exp ? 1 : nb_frames;
int cam_triggers = trig_exp ? nb_frames : 1;
int cam_frames = trigger_all_frames ? nb_frames : frames_per_trigger;
int cam_triggers = trigger_all_frames ? 1 : nb_frames / frames_per_trigger;
m_det->setNumberOfFrames(cam_frames);
m_det->setNumberOfTriggers(cam_triggers);
m_det->setNumberOfTriggers(cam_triggers);
// Set detector parameters
set_gain_mode(acq_params.det.gain_mode);
......
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