This commit is contained in:
maliakal_d 2022-11-08 10:25:12 +01:00
parent 16e9b272c7
commit 4a95ee8362
6 changed files with 68 additions and 60 deletions

View File

@ -103,7 +103,6 @@ class qTabMeasurement : public QWidget, private Ui::TabMeasurementObject {
int numMeasurements{1}; int numMeasurements{1};
int currentMeasurement{0}; int currentMeasurement{0};
mutable std::mutex mProgress; mutable std::mutex mProgress;
}; };
} // namespace sls } // namespace sls

View File

@ -1050,10 +1050,11 @@ int Feb_Control_StopAcquisition() {
// check stuck only 2000 times (1s) // check stuck only 2000 times (1s)
if (is_processing == STATUS_RUNNING) { if (is_processing == STATUS_RUNNING) {
if (check_stuck == 2000) { if (check_stuck == 2000) {
LOG(logERROR, ("Unable to get feb processing done signal\n")); LOG(logERROR,
("Unable to get feb processing done signal\n"));
// at least it is idle // at least it is idle
if (Feb_Control_AcquisitionInProgress() == STATUS_IDLE) { if (Feb_Control_AcquisitionInProgress() == STATUS_IDLE) {
return 1; return 1;
} }
LOG(logERROR, ("Unable to get acquisition done signal\n")); LOG(logERROR, ("Unable to get acquisition done signal\n"));
return 0; return 0;
@ -1757,9 +1758,8 @@ int Feb_Control_ReadRegister(uint32_t offset, uint32_t *retval) {
} }
// Inconsistent values when reading both registers // Inconsistent values when reading both registers
if ((run[0] & run[1]) & (value[0] != value[1])) { if ((run[0] & run[1]) & (value[0] != value[1])) {
LOG(logERROR, LOG(logERROR, ("Inconsistent values read from %s 0x%x and %s 0x%x\n",
("Inconsistent values read from %s 0x%x and %s 0x%x\n", side[0], value[0], side[1], value[1]));
side[0], value[0], side[1], value[1]));
return 0; return 0;
} }
return 1; return 1;

View File

@ -2185,7 +2185,8 @@ int setTrimbits(int *chanregs, char *mess) {
// if quad, set M8 and PROGRAM manually // if quad, set M8 and PROGRAM manually
if (!Feb_Control_SetChipSignalsToTrimQuad(1)) { if (!Feb_Control_SetChipSignalsToTrimQuad(1)) {
sprintf(mess, "Could not set module. Could not enable chip signals to set trimbits\n"); sprintf(mess, "Could not set module. Could not enable chip signals to "
"set trimbits\n");
LOG(logERROR, (mess)); LOG(logERROR, (mess));
sharedMemory_unlockLocalLink(); sharedMemory_unlockLocalLink();
return FAIL; return FAIL;
@ -2200,7 +2201,8 @@ int setTrimbits(int *chanregs, char *mess) {
// if quad, reset M8 and PROGRAM manually // if quad, reset M8 and PROGRAM manually
if (!Feb_Control_SetChipSignalsToTrimQuad(0)) { if (!Feb_Control_SetChipSignalsToTrimQuad(0)) {
sprintf(mess, "Could not set module. Could not disable chip signals to set trimbits\n"); sprintf(mess, "Could not set module. Could not disable chip "
"signals to set trimbits\n");
LOG(logERROR, (mess)); LOG(logERROR, (mess));
sharedMemory_unlockLocalLink(); sharedMemory_unlockLocalLink();
return FAIL; return FAIL;
@ -2212,7 +2214,8 @@ int setTrimbits(int *chanregs, char *mess) {
// if quad, reset M8 and PROGRAM manually // if quad, reset M8 and PROGRAM manually
if (!Feb_Control_SetChipSignalsToTrimQuad(0)) { if (!Feb_Control_SetChipSignalsToTrimQuad(0)) {
sprintf(mess, "Could not set module. Could not disable chip signals to set trimbits\n"); sprintf(mess, "Could not set module. Could not disable chip signals to "
"set trimbits\n");
LOG(logERROR, (mess)); LOG(logERROR, (mess));
sharedMemory_unlockLocalLink(); sharedMemory_unlockLocalLink();
return FAIL; return FAIL;
@ -2816,8 +2819,9 @@ int stopStateMachine() {
// reset feb and beb // reset feb and beb
sharedMemory_lockLocalLink(); sharedMemory_lockLocalLink();
// uncommenting this out as it randomly does not set the processing bit to high // uncommenting this out as it randomly does not set the processing bit to
//Feb_Control_Reset(); // high
// Feb_Control_Reset();
sharedMemory_unlockLocalLink(); sharedMemory_unlockLocalLink();
if (!Beb_StopAcquisition()) { if (!Beb_StopAcquisition()) {
LOG(logERROR, ("failed to stop acquisition\n")); LOG(logERROR, ("failed to stop acquisition\n"));

View File

@ -1527,7 +1527,11 @@ int write_register(int file_des) {
} else { } else {
if (readRegister(addr, &retval) == FAIL) { if (readRegister(addr, &retval) == FAIL) {
ret = FAIL; ret = FAIL;
sprintf(mess, "Could not read register 0x%x or inconsistent values. Try to read +0x100 for only left and +0x200 for only right.\n", addr); sprintf(
mess,
"Could not read register 0x%x or inconsistent values. Try "
"to read +0x100 for only left and +0x200 for only right.\n",
addr);
LOG(logERROR, (mess)); LOG(logERROR, (mess));
} }
} }
@ -1565,7 +1569,10 @@ int read_register(int file_des) {
#elif EIGERD #elif EIGERD
if (readRegister(addr, &retval) == FAIL) { if (readRegister(addr, &retval) == FAIL) {
ret = FAIL; ret = FAIL;
sprintf(mess, "Could not read register 0x%x or inconsistent values. Try +0x100 for only left and +0x200 for only right..\n", addr); sprintf(mess,
"Could not read register 0x%x or inconsistent values. Try "
"+0x100 for only left and +0x200 for only right..\n",
addr);
LOG(logERROR, (mess)); LOG(logERROR, (mess));
} }
#else #else
@ -1896,57 +1903,55 @@ int acquire(int blocking, int file_des) {
#ifdef EIGERD #ifdef EIGERD
// check for hardware mac and hardware ip // check for hardware mac and hardware ip
if (udpDetails[0].srcmac != getDetectorMAC()) { if (udpDetails[0].srcmac != getDetectorMAC()) {
ret = FAIL; ret = FAIL;
uint64_t sourcemac = getDetectorMAC(); uint64_t sourcemac = getDetectorMAC();
char src_mac[MAC_ADDRESS_SIZE]; char src_mac[MAC_ADDRESS_SIZE];
getMacAddressinString(src_mac, MAC_ADDRESS_SIZE, sourcemac); getMacAddressinString(src_mac, MAC_ADDRESS_SIZE, sourcemac);
sprintf( sprintf(mess,
mess,
"Invalid udp source mac address for this detector. Must be " "Invalid udp source mac address for this detector. Must be "
"same as hardware detector mac address %s\n", "same as hardware detector mac address %s\n",
src_mac); src_mac);
LOG(logERROR, (mess)); LOG(logERROR, (mess));
} else if (!enableTenGigabitEthernet(GET_FLAG) && } else if (!enableTenGigabitEthernet(GET_FLAG) &&
(udpDetails[0].srcip != getDetectorIP())) { (udpDetails[0].srcip != getDetectorIP())) {
ret = FAIL; ret = FAIL;
uint32_t sourceip = getDetectorIP(); uint32_t sourceip = getDetectorIP();
char src_ip[INET_ADDRSTRLEN]; char src_ip[INET_ADDRSTRLEN];
getIpAddressinString(src_ip, sourceip); getIpAddressinString(src_ip, sourceip);
sprintf( sprintf(mess,
mess,
"Invalid udp source ip address for this detector. Must be " "Invalid udp source ip address for this detector. Must be "
"same as hardware detector ip address %s in 1G readout " "same as hardware detector ip address %s in 1G readout "
"mode \n", "mode \n",
src_ip); src_ip);
LOG(logERROR, (mess)); LOG(logERROR, (mess));
} else } else
#endif #endif
if (configured == FAIL) { if (configured == FAIL) {
ret = FAIL;
strcpy(mess, "Could not start acquisition because ");
strcat(mess, configureMessage);
LOG(logERROR, (mess));
} else if (sharedMemory_getScanStatus() == RUNNING) {
ret = FAIL;
strcpy(mess, "Could not start acquisition because a scan is "
"already running!\n");
LOG(logERROR, (mess));
} else {
memset(scanErrMessage, 0, MAX_STR_LENGTH);
sharedMemory_setScanStop(0);
sharedMemory_setScanStatus(IDLE); // if it was error
if (pthread_create(&pthread_tid, NULL, &start_state_machine,
&blocking)) {
ret = FAIL; ret = FAIL;
strcpy(mess, "Could not start acquisition because "); strcpy(mess, "Could not start acquisition thread!\n");
strcat(mess, configureMessage);
LOG(logERROR, (mess));
} else if (sharedMemory_getScanStatus() == RUNNING) {
ret = FAIL;
strcpy(mess, "Could not start acquisition because a scan is "
"already running!\n");
LOG(logERROR, (mess)); LOG(logERROR, (mess));
} else { } else {
memset(scanErrMessage, 0, MAX_STR_LENGTH); // only does not wait for non blocking and scan
sharedMemory_setScanStop(0); if (blocking || !scan) {
sharedMemory_setScanStatus(IDLE); // if it was error pthread_join(pthread_tid, NULL);
if (pthread_create(&pthread_tid, NULL, &start_state_machine,
&blocking)) {
ret = FAIL;
strcpy(mess, "Could not start acquisition thread!\n");
LOG(logERROR, (mess));
} else {
// only does not wait for non blocking and scan
if (blocking || !scan) {
pthread_join(pthread_tid, NULL);
}
} }
} }
}
} }
return Server_SendResult(file_des, INT32, NULL, 0); return Server_SendResult(file_des, INT32, NULL, 0);
} }

View File

@ -2562,8 +2562,9 @@ std::string CmdProxy::AdcVpp(int action) {
if (action == defs::HELP_ACTION) { if (action == defs::HELP_ACTION) {
os << "[dac or mV value][(optional unit) mV] \n\t[Ctb][Moench] Vpp of " os << "[dac or mV value][(optional unit) mV] \n\t[Ctb][Moench] Vpp of "
"ADC.\n\t 0 -> 1V ; 1 -> 1.14V ; 2 -> 1.33V ; 3 -> 1.6V ; 4 -> 2V. " "ADC.\n\t 0 -> 1V ; 1 -> 1.14V ; 2 -> 1.33V ; 3 -> 1.6V ; 4 -> "
"\n\tAdvanced User function!\n" "2V. "
"\n\tAdvanced User function!\n"
<< '\n'; << '\n';
return os.str(); return os.str();
} }
@ -2593,8 +2594,7 @@ std::string CmdProxy::AdcVpp(int action) {
} else if (args.size() > 2 || args.size() < 1) { } else if (args.size() > 2 || args.size() < 1) {
WrongNumberOfParameters(1); WrongNumberOfParameters(1);
} }
det->setADCVpp(StringTo<int>(args[0]), mV, det->setADCVpp(StringTo<int>(args[0]), mV, std::vector<int>{det_id});
std::vector<int>{det_id});
os << args[0] << (mV ? " mV\n" : "\n"); os << args[0] << (mV ? " mV\n" : "\n");
} else { } else {
throw RuntimeError("Unknown action"); throw RuntimeError("Unknown action");

View File

@ -10,5 +10,5 @@
#define APIGOTTHARD2 0x221018 #define APIGOTTHARD2 0x221018
#define APIJUNGFRAU 0x221018 #define APIJUNGFRAU 0x221018
#define APIMOENCH 0x221018 #define APIMOENCH 0x221018
#define APIMYTHEN3 0x221107 #define APIMYTHEN3 0x221107
#define APIEIGER 0x221107 #define APIEIGER 0x221107