Back Midas Rome Roody Rootana
  Midas DAQ System  Not logged in ELOG logo
Entry  01 Dec 2017, Frederik Wauters, Bug Report, small bug in mfe.c init 
    Reply  01 Dec 2017, Stefan Ritt, Bug Report, small bug in mfe.c init 
       Reply  04 Dec 2017, Frederik Wauters, Bug Report, small bug in mfe.c init 
          Reply  04 Dec 2017, Stefan Ritt, Bug Report, small bug in mfe.c init 
Message ID: 1330     Entry time: 01 Dec 2017     Reply to this: 1332
Author: Frederik Wauters 
Topic: Bug Report 
Subject: small bug in mfe.c init 
There is a small bug in the mfe.c initialization for the EQ_POLLED mode. There 
is a routine where the number of polls fitting in eq_info->period is counted:


         count = 1;
         do {
            if (display_period)
               printf(".");

            start_time = ss_millitime();

            poll_event(equipment[idx].info.source, (INT)count, TRUE);

            delta_time = ss_millitime() - start_time;

            ...

            if (delta_time > 0)
               count = count * eq_info->period / delta_time;
            else
               count *= 100;
            
            // avoid overflows
            if (count > 2147483647.0) {
               count = 2147483647.0;
               break;
            }
            
         } while (delta_time > eq_info->period * 1.2 || delta_time < eq_info-
>period * 0.8);

As "start_time = ss_millitime();" resets "delta_time" each time, only the 
"avoid overflows" addition saves the day. 

start_time = ss_millitime(); show be out of the loop.
ELOG V3.1.4-2e1708b5