adds a POC preset based count

This commit is contained in:
2025-10-31 13:23:55 +01:00
parent b9e5f40c21
commit 1e853487aa
6 changed files with 460 additions and 62 deletions

View File

@@ -36,6 +36,12 @@ struct __attribute__((__packed__)) DetectorEvent {
uint16_t Amplitude : 8;
uint16_t Id : 1;
inline uint32_t nanosecs() { return TimeStamp * 100; }
inline uint64_t pixelId(uint32_t mpcdId) {
const uint32_t x_pixels = 128;
const uint32_t y_pixels = 128;
return (mpcdId - 1) * x_pixels * y_pixels +
x_pixels * (uint32_t)this->XPosition + (uint32_t)this->YPosition;
}
};
struct __attribute__((__packed__)) MonitorEvent {
@@ -60,12 +66,24 @@ struct __attribute__((__packed__)) NormalisedDetectorEvent {
uint32_t PixID;
};
/*******************************************************************************
* Status values that should match the definition in db/daq_common.db
*/
#define STATUS_IDLE 0
#define STATUS_COUNTING 1
#define STATUS_LOWRATE 2
#define STATUS_PAUSED 3
/*******************************************************************************
* Parameters for use in DB records
*
* i.e.e drvInfo strings that are used to identify the parameters
*/
#define P_StatusString "STATUS"
#define P_ResetString "RESET"
#define P_CountPresetString "P_CNT"
#define P_MonitorChannelString "MONITOR"
#define P_CountsString "COUNTS%d"
/*******************************************************************************
@@ -77,16 +95,23 @@ class asynStreamGeneratorDriver : public asynPortDriver {
const int numChannels);
virtual ~asynStreamGeneratorDriver();
virtual asynStatus writeInt32(asynUser *pasynUser, epicsInt32 value);
void receiveUDP();
void produceMonitor();
void produceDetector();
protected:
// Parameter Identifying IDs
int P_Status;
int P_Reset;
int P_CountPreset;
int P_MonitorChannel;
int *P_Counts;
private:
asynUser *pasynUDPUser;
epicsEventId pausedEventId;
int num_channels;