mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-14 05:47:14 +02:00
wip
This commit is contained in:
@ -998,19 +998,21 @@ int Feb_Control_StartAcquisition() {
|
|||||||
|
|
||||||
int Feb_Control_StopAcquisition() { return Feb_Control_Reset(); }
|
int Feb_Control_StopAcquisition() { return Feb_Control_Reset(); }
|
||||||
|
|
||||||
int Feb_Control_SoftwareTrigger(int block) {
|
int Feb_Control_GetExposureStatus(int *toggle, int *exposure) {
|
||||||
if (Feb_Control_activated) {
|
|
||||||
// read exp toggle value
|
|
||||||
unsigned int value = 0;
|
unsigned int value = 0;
|
||||||
if (!Feb_Interface_ReadRegister(Feb_Control_AddressToAll(),
|
if (!Feb_Interface_ReadRegister(Feb_Control_AddressToAll(), FEB_REG_STATUS,
|
||||||
FEB_REG_STATUS, &value)) {
|
&value)) {
|
||||||
LOG(logERROR, ("Could not read FEB_REG_STATUS reg\n"));
|
LOG(logERROR, ("Could not read FEB_REG_STATUS reg\n"));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
int prev_toggle = ((value & FEB_REG_STATUS_EXP_TGL_MSK) >>
|
*toggle =
|
||||||
FEB_REG_STATUS_EXP_TGL_OFST);
|
((value & FEB_REG_STATUS_EXP_TGL_MSK) >> FEB_REG_STATUS_EXP_TGL_OFST);
|
||||||
|
*exposure = ((value & FEB_REG_STATUS_EXP_MSK) >> FEB_REG_STATUS_EXP_OFST);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
// send software trigger
|
int Feb_Control_SendSoftwareTrigger() {
|
||||||
|
// read old value in register
|
||||||
unsigned int orig_value = 0;
|
unsigned int orig_value = 0;
|
||||||
if (!Feb_Interface_ReadRegister(Feb_Control_AddressToAll(),
|
if (!Feb_Interface_ReadRegister(Feb_Control_AddressToAll(),
|
||||||
DAQ_REG_CHIP_CMDS, &orig_value)) {
|
DAQ_REG_CHIP_CMDS, &orig_value)) {
|
||||||
@ -1035,39 +1037,49 @@ int Feb_Control_SoftwareTrigger(int block) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
LOG(logINFO, ("Software Internal Trigger Sent!\n"));
|
LOG(logINFO, ("Software Internal Trigger Sent!\n"));
|
||||||
|
}
|
||||||
|
|
||||||
|
int Feb_Control_SoftwareTrigger(int block) {
|
||||||
|
if (Feb_Control_activated) {
|
||||||
|
|
||||||
|
int prev_toggle = 0, toggle = 0, prev_exposure = 0, exposure = 0;
|
||||||
|
|
||||||
|
// remember previous toggle
|
||||||
|
if (!Feb_Control_GetExposureStatus(&prev_toggle, &exposure)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
Feb_Control_SendSoftwareTrigger();
|
||||||
|
|
||||||
// wait for trigger for 20ms
|
// wait for trigger for 20ms
|
||||||
usleep(20 * 1000);
|
usleep();
|
||||||
if (!Feb_Interface_ReadRegister(Feb_Control_AddressToAll(),
|
|
||||||
FEB_REG_STATUS, &value)) {
|
// get current toggle value
|
||||||
LOG(logERROR, ("Could not read FEB_REG_STATUS reg\n"));
|
if (!Feb_Control_GetExposureToggle(&toggle, &exposure)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
int toggle = ((value & FEB_REG_STATUS_EXP_TGL_MSK) >>
|
|
||||||
FEB_REG_STATUS_EXP_TGL_OFST);
|
|
||||||
|
|
||||||
// no toggle, so no trigger
|
// no toggle error
|
||||||
if (toggle == prev_toggle) {
|
if (toggle == prev_toggle) {
|
||||||
LOG(logERROR, ("Software trigger failed. No exposure toggle "
|
LOG(logERROR, ("Software trigger failed. No exposure toggle "
|
||||||
"detected in 20ms.\n"));
|
"detected.\n"));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// read that it exposed
|
// no exposure
|
||||||
int exposure =
|
|
||||||
((value & FEB_REG_STATUS_EXP_MSK) >> FEB_REG_STATUS_EXP_OFST);
|
|
||||||
if (!exposure) {
|
if (!exposure) {
|
||||||
LOG(logERROR,
|
LOG(logERROR, ("Software trigger failed. No exposure detected.\n"));
|
||||||
("Software trigger failed. No exposure detected in 20ms.\n"));
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
prev_exposure = exposure;
|
||||||
|
|
||||||
// wait for toggle for exposure to be done
|
// wait for exposure to be done
|
||||||
if (block) {
|
if (block) {
|
||||||
while (toggle == prev_toggle) {
|
while (prev_exposure == exposure) {
|
||||||
usleep(5000);
|
usleep(5000);
|
||||||
toggle = ((value & FEB_REG_STATUS_EXP_TGL_MSK) >>
|
if (!Feb_Control_GetExposureStatus(&prev_toggle, &exposure)) {
|
||||||
FEB_REG_STATUS_EXP_TGL_OFST);
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,6 +55,9 @@ int Feb_Control_PrepareForAcquisition();
|
|||||||
void Feb_Control_PrintAcquisitionSetup();
|
void Feb_Control_PrintAcquisitionSetup();
|
||||||
int Feb_Control_StartAcquisition();
|
int Feb_Control_StartAcquisition();
|
||||||
int Feb_Control_StopAcquisition();
|
int Feb_Control_StopAcquisition();
|
||||||
|
int Feb_Control_GetExposureToggle(int *toggle, int *exposure);
|
||||||
|
int Feb_Control_GetExposureStatus(int *status);
|
||||||
|
int Feb_Control_SendSoftwareTrigger();
|
||||||
int Feb_Control_SoftwareTrigger(int block);
|
int Feb_Control_SoftwareTrigger(int block);
|
||||||
|
|
||||||
// parameters
|
// parameters
|
||||||
|
Reference in New Issue
Block a user