diff --git a/db/daq_common.db b/db/daq_common.db index 3f3af55..fbbd9c9 100644 --- a/db/daq_common.db +++ b/db/daq_common.db @@ -43,8 +43,8 @@ record(mbbi, "$(INSTR)$(NAME):RAW-STATUS") field(FRVL, "4") field(FRST, "INVALID") # This is probably too fast. We could trigger things the same as sinqDAQ to ensure the db is update in the same order - #field(SCAN, "I/O Intr") - field(SCAN, ".2 second") + # field(SCAN, "I/O Intr") + field(SCAN, ".1 second") field(FLNK, "$(INSTR)$(NAME):READALL") field(PINI, "YES") } @@ -171,7 +171,7 @@ record(longin, "$(INSTR)$(NAME):MONITOR-CHANNEL_RBV") field(DESC, "PRESET-COUNT Monitors this channel") field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),0,$(TIMEOUT=1)) MONITOR") - field(SCAN, "I/O Intr") + field(SCAN, ".2 second") field(PINI, "YES") } diff --git a/src/asynStreamGeneratorDriver.cpp b/src/asynStreamGeneratorDriver.cpp index 3e1ae89..e438c14 100644 --- a/src/asynStreamGeneratorDriver.cpp +++ b/src/asynStreamGeneratorDriver.cpp @@ -395,49 +395,48 @@ asynStatus asynStreamGeneratorDriver::writeInt32(asynUser *pasynUser, // TODO should check everything... if (function == P_CountPreset) { if (!currentStatus) { + // slightly longer than the status update frequency + // i.e. "$(INSTR)$(NAME):RAW-STATUS" SCAN seconds + // to ensure that the counts have all had a chance + // to update their values before starting a count + epicsThreadSleep(0.12); // seconds setIntegerParam(function, value); setIntegerParam(P_Status, STATUS_COUNTING); - status = (asynStatus)callParamCallbacks(); } else { return asynError; } } else if (function == P_TimePreset) { if (!currentStatus) { + // slightly longer than the status update frequency + // i.e. "$(INSTR)$(NAME):RAW-STATUS" SCAN seconds + // to ensure that the counts have all had a chance + // to update their values before starting a count + epicsThreadSleep(0.12); // seconds setIntegerParam(function, value); setIntegerParam(P_Status, STATUS_COUNTING); - status = (asynStatus)callParamCallbacks(); } else { return asynError; } } else if (function == P_ClearElapsedTime) { if (!currentStatus) { setDoubleParam(P_ElapsedTime, 0); - status = (asynStatus)callParamCallbacks(); } else { return asynError; } } else if (isClearCount) { if (!currentStatus) { setInteger64Param(P_Counts[channelToClear], 0); - status = (asynStatus)callParamCallbacks(); } else { return asynError; } } else if (function == P_Reset) { - lock(); // TODO should probably set back everything to defaults setIntegerParam(P_Status, STATUS_IDLE); - status = (asynStatus)callParamCallbacks(); - unlock(); } else if (function == P_Stop) { - lock(); setIntegerParam(P_Status, STATUS_IDLE); - status = (asynStatus)callParamCallbacks(); - unlock(); } else if (function == P_MonitorChannel) { if (!currentStatus) { setIntegerParam(function, value); - status = (asynStatus)callParamCallbacks(); } else { return asynError; } @@ -457,7 +456,7 @@ asynStatus asynStreamGeneratorDriver::writeInt32(asynUser *pasynUser, } } else { setIntegerParam(function, value); - status = (asynStatus)callParamCallbacks(); + //status = (asynStatus)callParamCallbacks(); } if (status) @@ -664,7 +663,7 @@ inline void asynStreamGeneratorDriver::queueForKafka(NormalisedEvent &ne) { void asynStreamGeneratorDriver::processEvents() { - // const char functionName[]{"processEvents"}; + const char functionName[]{"processEvents"}; // x * number of ids * max events in packet * event size int bufferedEvents = 5 * 10 * 243; @@ -753,6 +752,11 @@ void asynStreamGeneratorDriver::processEvents() { for (std::size_t i = 0; i < this->num_channels; ++i) { counts[i] = 0; } + + // asynPrint( + // pasynUserSelf, ASYN_TRACE_ERROR, + // "%s:%s: started %"PRIu64" %d\n", + // driverName, functionName, (uint64_t) counts[presetChannel], presetChannel); } if (currStatus == STATUS_COUNTING) { @@ -772,6 +776,11 @@ void asynStreamGeneratorDriver::processEvents() { (timePreset && elapsedSeconds > (double)timePreset)) { elapsedSeconds = timePreset == 0 ? elapsedSeconds : timePreset; + + // asynPrint( + // pasynUserSelf, ASYN_TRACE_ERROR, + // "%s:%s: counted %"PRIu64" %d\n", + // driverName, functionName, (uint64_t) counts[presetChannel], presetChannel); break; }