fixed jungfau virtual server as well

This commit is contained in:
maliakal_d 2019-11-06 11:05:02 +01:00
parent ba37a51858
commit c3180737ed
4 changed files with 27 additions and 13 deletions

View File

@ -1798,8 +1798,11 @@ void* start_timer(void* arg) {
int64_t time_ns = ((end.tv_sec - begin.tv_sec) * 1E9 +
(end.tv_nsec - begin.tv_nsec));
if (periodns > time_ns) {
usleep((periodns - time_ns)/ 1000);
// sleep for (period - exptime)
if (frameNr < numFrames) { // if there is a next frame
if (periodns > time_ns) {
usleep((periodns - time_ns)/ 1000);
}
}
}
}

View File

@ -915,9 +915,11 @@ void* start_timer(void* arg) {
(end.tv_nsec - begin.tv_nsec));
// sleep for (period - exptime)
if (periodns > time_ns) {
usleep((periodns - time_ns)/ 1000);
}
if (frameNr < numFrames) { // if there is a next frame
if (periodns > time_ns) {
usleep((periodns - time_ns)/ 1000);
}
}
// set register frames left
}

View File

@ -1673,7 +1673,7 @@ void* start_timer(void* arg) {
int numFrames = (getNumFrames() *
getNumTriggers() *
(getNumAdditionalStorageCells() + 1));
int64_t exp_ns = getExpTime();
int64_t exp_us = getExpTime() / 1000;
//TODO: Generate data
char imageData[DATA_BYTES];
@ -1691,12 +1691,18 @@ void* start_timer(void* arg) {
{
int frameNr = 0;
for(frameNr=0; frameNr!= numFrames; ++frameNr ) {
//check if virtual_stop is high
if(virtual_stop == 1){
break;
}
int srcOffset = 0;
struct timespec begin, end;
clock_gettime(CLOCK_REALTIME, &begin);
usleep(exp_ns / 1000);
usleep(exp_us);
const int size = datasize + 112;
char packetData[size];
@ -1722,8 +1728,11 @@ void* start_timer(void* arg) {
int64_t time_ns = ((end.tv_sec - begin.tv_sec) * 1E9 +
(end.tv_nsec - begin.tv_nsec));
if (periodns > time_ns) {
usleep((periodns - time_ns)/ 1000);
// sleep for (period - exptime)
if (frameNr < numFrames) { // if there is a next frame
if (periodns > time_ns) {
usleep((periodns - time_ns)/ 1000);
}
}
}
}
@ -1810,13 +1819,13 @@ enum runStatus getRunStatus(){
void readFrame(int *ret, char *mess){
#ifdef VIRTUAL
FILE_LOG(logINFOGREEN, ("acquisition successfully finished\n"));
return;
#endif
// wait for status to be done
while(runBusy()){
usleep(500);
}
FILE_LOG(logINFOGREEN, ("acquisition successfully finished\n"));
return;
#endif
*ret = (int)OK;
// frames left to give status

View File

@ -1831,7 +1831,7 @@ int start_and_read_all(int file_des) {
} else {
ret = startStateMachine();
if (ret == FAIL) {
#if defined(CHIPTESTBOARDD) || defined(MOENCHD)
#if defined(VIRTUAL) || defined(CHIPTESTBOARDD) || defined(MOENCHD)
sprintf(mess, "Could not start acquisition. Could not create udp socket in server. Check udp_dstip & udp_dstport.\n");
#else
sprintf(mess, "Could not start acquisition\n");