mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-21 11:20:04 +02:00
wip
This commit is contained in:
parent
927d642bf7
commit
0d01de451a
@ -998,23 +998,19 @@ int Feb_Control_StartAcquisition() {
|
|||||||
|
|
||||||
int Feb_Control_StopAcquisition() { return Feb_Control_Reset(); }
|
int Feb_Control_StopAcquisition() { return Feb_Control_Reset(); }
|
||||||
|
|
||||||
int Feb_Control_GetExposureStatus(int left, int *rising, int *falling,
|
int int Feb_Control_IsReadyForTrigger(int *readyForTrigger) {
|
||||||
int *exposure) {
|
unsigned int addr[2] = {Feb_Control_leftAddress, Feb_Control_rightAddress};
|
||||||
|
unsigned int value[2] = {0, 0};
|
||||||
|
|
||||||
unsigned int addr =
|
for (int i = 0; i < 2; ++i) {
|
||||||
(left == 1 ? Feb_Control_leftAddress : Feb_Control_rightAddress);
|
if (!Feb_Interface_ReadRegister(addr[i], FEB_REG_STATUS, &value[i])) {
|
||||||
unsigned int value = 0;
|
LOG(logERROR, ("Could not read %s FEB_REG_STATUS reg\n",
|
||||||
if (!Feb_Interface_ReadRegister(addr, FEB_REG_STATUS, &value)) {
|
(i == 0 ? "left" : "right")));
|
||||||
LOG(logERROR, ("Could not read %s FEB_REG_STATUS reg\n",
|
return 0;
|
||||||
(left == 1 ? "left" : "right")));
|
}
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
LOG(logINFORED, ("febregstatus:0x%x\n", value));
|
*readyForTrigger =
|
||||||
*rising = ((value & FEB_REG_STATUS_EXP_TGL_RISING_MSK) >>
|
((value[0] | value[1]) & FEB_REG_STATUS_WAIT_FOR_TRGGR_MSK);
|
||||||
FEB_REG_STATUS_EXP_TGL_RISING_OFST);
|
|
||||||
*falling = ((value & FEB_REG_STATUS_EXP_TGL_FALLING_MSK) >>
|
|
||||||
FEB_REG_STATUS_EXP_TGL_FALLING_OFST);
|
|
||||||
*exposure = ((value & FEB_REG_STATUS_EXP_MSK) >> FEB_REG_STATUS_EXP_OFST);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1049,77 +1045,41 @@ int Feb_Control_SendSoftwareTrigger() {
|
|||||||
|
|
||||||
int Feb_Control_SoftwareTrigger(int block) {
|
int Feb_Control_SoftwareTrigger(int block) {
|
||||||
if (Feb_Control_activated) {
|
if (Feb_Control_activated) {
|
||||||
|
/*
|
||||||
int rising[2] = {0, 0}, falling[2] = {0, 0}, exposure[2] = {0, 0},
|
// if not ready for trigger, throw
|
||||||
prev_toggle[2] = {0, 0};
|
int readyForTrigger = 0;
|
||||||
for (int i = 0; i < 1; ++i) {
|
if (!Feb_Control_IsReadyForTrigger(&readyForTrigger)) {
|
||||||
if (!Feb_Control_GetExposureStatus(i, &rising[i], &falling[i],
|
LOG(logWARNING, ("Not yet ready for trigger!\n"));
|
||||||
&exposure[i])) {
|
return 0;
|
||||||
return 0;
|
}
|
||||||
}
|
*/
|
||||||
|
|
||||||
if (exposure[i]) {
|
|
||||||
LOG(logERROR,
|
|
||||||
("Software trigger failed. %s FPGA still exposing.\n",
|
|
||||||
i == 1 ? "left" : "right"));
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// remember previous rising toggle
|
|
||||||
prev_toggle[i] = rising[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
// send trigger to both fpgas
|
// send trigger to both fpgas
|
||||||
Feb_Control_SendSoftwareTrigger();
|
Feb_Control_SendSoftwareTrigger();
|
||||||
|
|
||||||
// will need to wait if delay after trigger introduced
|
/*
|
||||||
// usleep(0);
|
// will need to wait if delay after trigger introduced
|
||||||
|
// usleep(0);
|
||||||
for (int i = 0; i < 1; ++i) {
|
// wait for exposure to be done
|
||||||
// get current toggle value
|
if (block) {
|
||||||
if (!Feb_Control_GetExposureStatus(i, &rising[i], &falling[i],
|
for (int i = 0; i < 1; ++i) {
|
||||||
&exposure[i])) {
|
prev_toggle[i] = falling[i];
|
||||||
return 0;
|
while (prev_toggle[i] == falling[i]) {
|
||||||
}
|
usleep(5000);
|
||||||
|
if (!Feb_Control_GetExposureStatus(
|
||||||
// no toggle error
|
i, &rising[i], &falling[i], &exposure[i])) {
|
||||||
if (rising[i] == prev_toggle[i]) {
|
return 0;
|
||||||
LOG(logERROR, ("Software trigger failed. No exposure toggle "
|
}
|
||||||
"detected on %s fpga.\n",
|
}
|
||||||
i == 1 ? "left" : "right"));
|
// exposure low
|
||||||
return 0;
|
if (exposure[i]) {
|
||||||
}
|
LOG(logERROR,
|
||||||
|
("Software trigger failed. Still exposing after
|
||||||
// no exposure
|
" "exposure finished toggled in %s fpga.\n", i == 1 ? "left" :
|
||||||
if (!exposure[i]) {
|
"right")); return 0;
|
||||||
LOG(logERROR, ("Software trigger failed. No exposure detected "
|
}
|
||||||
"on %s fpga.\n",
|
|
||||||
i == 1 ? "left" : "right"));
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// wait for exposure to be done
|
|
||||||
if (block) {
|
|
||||||
for (int i = 0; i < 1; ++i) {
|
|
||||||
prev_toggle[i] = falling[i];
|
|
||||||
while (prev_toggle[i] == falling[i]) {
|
|
||||||
usleep(5000);
|
|
||||||
if (!Feb_Control_GetExposureStatus(
|
|
||||||
i, &rising[i], &falling[i], &exposure[i])) {
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// exposure low
|
*/
|
||||||
if (exposure[i]) {
|
|
||||||
LOG(logERROR,
|
|
||||||
("Software trigger failed. Still exposing after "
|
|
||||||
"exposure finished toggled in %s fpga.\n",
|
|
||||||
i == 1 ? "left" : "right"));
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -55,8 +55,7 @@ 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_GetExposureStatus(int left, int *rising, int *falling,
|
int Feb_Control_IsReadyForTrigger(int *readyForTrigger);
|
||||||
int *exposure);
|
|
||||||
int Feb_Control_SendSoftwareTrigger();
|
int Feb_Control_SendSoftwareTrigger();
|
||||||
int Feb_Control_SoftwareTrigger(int block);
|
int Feb_Control_SoftwareTrigger(int block);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user