DectrisSimplonClient: Reduce number of calls to Simplon API at start
This commit is contained in:
@@ -91,6 +91,12 @@ void DectrisSimplonClient::SetConfigIfDifferent(SimplonModule element, const std
|
||||
SetConfig(element, key, value);
|
||||
}
|
||||
|
||||
void DectrisSimplonClient::SetConfigIfDifferent(SimplonModule element, const std::string &key, int64_t value) {
|
||||
auto curr_val = GetConfig(element, key).val.get<int64_t>();
|
||||
if (curr_val != value)
|
||||
SetConfig(element, key, value);
|
||||
}
|
||||
|
||||
std::string DectrisSimplonClient::GenAddr(SimplonModule element, SimplonTask task, const std::string& key) {
|
||||
std::string addr;
|
||||
switch (element) {
|
||||
@@ -232,18 +238,19 @@ void DectrisSimplonClient::EndAcquisitionFinished() {
|
||||
|
||||
void DectrisSimplonClient::StartAcquisition(const DiffractionExperiment& experiment) {
|
||||
// For DECTRIS detectors we assume frame_time == count_time
|
||||
// but give it 100 ns resolution
|
||||
if (experiment.GetFrameCountTimeAuto())
|
||||
SetConfig(SimplonModule::Detector, "count_time", experiment.GetFrameTime().count() / 1e6f);
|
||||
SetConfigIfDifferent(SimplonModule::Detector, "count_time", experiment.GetFrameTime().count() / 1e6f, 1e-7);
|
||||
else
|
||||
SetConfig(SimplonModule::Detector, "count_time", experiment.GetFrameCountTime().count() / 1e6f);
|
||||
SetConfigIfDifferent(SimplonModule::Detector, "count_time", experiment.GetFrameCountTime().count() / 1e6f, 1e-9);
|
||||
|
||||
SetConfig(SimplonModule::Detector, "frame_time", experiment.GetFrameTime().count() / 1e6f);
|
||||
SetConfig(SimplonModule::Detector, "nimages", experiment.GetFrameNumPerTrigger());
|
||||
SetConfig(SimplonModule::Detector, "ntrigger", experiment.GetNumTriggers());
|
||||
SetConfigIfDifferent(SimplonModule::Detector, "frame_time", experiment.GetFrameTime().count() / 1e6f, 1e-9);
|
||||
SetConfigIfDifferent(SimplonModule::Detector, "nimages", experiment.GetFrameNumPerTrigger());
|
||||
SetConfigIfDifferent(SimplonModule::Detector, "ntrigger", experiment.GetNumTriggers());
|
||||
|
||||
SetConfig(SimplonModule::Detector, "beam_center_x", experiment.GetBeamX_pxl());
|
||||
SetConfig(SimplonModule::Detector, "beam_center_y", experiment.GetBeamY_pxl());
|
||||
SetConfig(SimplonModule::Detector, "detector_distance", experiment.GetDetectorDistance_mm() / 1e3f);
|
||||
SetConfigIfDifferent(SimplonModule::Detector, "beam_center_x", experiment.GetBeamX_pxl(), 1e-6);
|
||||
SetConfigIfDifferent(SimplonModule::Detector, "beam_center_y", experiment.GetBeamY_pxl(), 1e-6);
|
||||
SetConfigIfDifferent(SimplonModule::Detector, "detector_distance", experiment.GetDetectorDistance_mm() / 1e3f, 1e-9);
|
||||
|
||||
SendDetectorCommand(SimplonDetectorCommand::Arm);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user