Today we updated the SusDAQBridge and PySat servers, fixing the issue that was causing the misreading of various gains described in previous entries (e.g. here and here).
The problem we identified was that, when reading a gain value, the DSP is not always queried. Along with each gain, a timestamp containing the last access time of this gain is kept. If the timestamp of the gain is less than 25 msec from the current time, the DSP is not queried and the value that is stored in memory is returned instead. This time comparison was performed using integer values, and given that the timestamps are in microseconds, the result were frequent integer overflows when the time difference was more than 33 minutes.
To remedy the issue, two actions were taken:
- The time difference has been set to long long, allowing the comparison of the timestamps without overflowing.
- When the gain is changed using PySat, the timestamp and the new value are stored in the memory, so even in case of the overflow appearing again, the last set value is going to be returned.