makes detector channel the last channel
Some checks failed
Test And Build / Build (push) Failing after 2s
Test And Build / Lint (push) Successful in 3s

This commit is contained in:
2025-11-18 07:58:02 +01:00
parent 0819c5fb12
commit d7a4d057aa
3 changed files with 45 additions and 45 deletions

View File

@@ -169,8 +169,8 @@ asynStreamGeneratorDriver::asynStreamGeneratorDriver(
status = createFloat64Param(status, P_ElapsedTimeString, &P_ElapsedTime);
status =
createInt32Param(status, P_ClearElapsedTimeString, &P_ClearElapsedTime);
status =
createInt32Param(status, P_MonitorChannelString, &P_MonitorChannel);
status = createInt32Param(status, P_MonitorChannelString, &P_MonitorChannel,
this->num_channels);
status = createInt32Param(status, P_ThresholdString, &P_Threshold, 1);
status = createInt32Param(status, P_ThresholdChannelString,
&P_ThresholdChannel, 1);
@@ -182,15 +182,15 @@ asynStreamGeneratorDriver::asynStreamGeneratorDriver(
P_ClearCounts = new int[this->num_channels];
for (std::size_t i = 0; i < this->num_channels; ++i) {
memset(pv_name_buffer, 0, 100);
epicsSnprintf(pv_name_buffer, 100, P_CountsString, i);
epicsSnprintf(pv_name_buffer, 100, P_CountsString, i + 1);
status = createInt64Param(status, pv_name_buffer, P_Counts + i);
memset(pv_name_buffer, 0, 100);
epicsSnprintf(pv_name_buffer, 100, P_RateString, i);
epicsSnprintf(pv_name_buffer, 100, P_RateString, i + 1);
status = createInt32Param(status, pv_name_buffer, P_Rates + i);
memset(pv_name_buffer, 0, 100);
epicsSnprintf(pv_name_buffer, 100, P_ClearCountsString, i);
epicsSnprintf(pv_name_buffer, 100, P_ClearCountsString, i + 1);
status = createInt32Param(status, pv_name_buffer, P_ClearCounts + i);
}
@@ -409,15 +409,13 @@ asynStatus asynStreamGeneratorDriver::writeInt32(asynUser *pasynUser,
}
} else if (function == P_ClearElapsedTime) {
if (!currentStatus) {
setIntegerParam(P_ElapsedTime, 0);
status = (asynStatus)callParamCallbacks();
setDoubleParam(P_ElapsedTime, 0);
} else {
return asynError;
}
} else if (isClearCount) {
if (!currentStatus) {
setInteger64Param(P_Counts[channelToClear], 0);
status = (asynStatus)callParamCallbacks();
} else {
return asynError;
}
@@ -726,6 +724,9 @@ void asynStreamGeneratorDriver::processEvents() {
getIntegerParam(this->P_TimePreset, &timePreset);
getIntegerParam(this->P_MonitorChannel, &presetChannel);
// Parameter is base 1, here we need base 0
--presetChannel;
// reset status variables
startTimestamp = eventsA[0].timestamp;
elapsedSeconds = 0;
@@ -741,15 +742,17 @@ void asynStreamGeneratorDriver::processEvents() {
// try and make sure the data we send to kafka is correct, while
// the measurement time also appears intuitive.
for (std::size_t i = 0; i < toProcess; ++i) {
counts[eventsA[i].source == 0 ? eventsA[i].pixelId + 1 : 0] +=
1;
counts[eventsA[i].source == 0 ? eventsA[i].pixelId
: this->num_channels - 1] += 1;
elapsedSeconds = (eventsA[i].timestamp - startTimestamp) / 1e9;
// TODO should really check there an no more events with the
// same final timestamp
if ((countPreset && counts[presetChannel] >= countPreset) ||
(timePreset && elapsedSeconds > (double)timePreset))
(timePreset && elapsedSeconds > (double)timePreset)) {
elapsedSeconds = timePreset;
break;
}
// TODO also batchwise?
this->queueForKafka(eventsA[i]);