From 7718fe5454d689c4e111f33c23bffe4dd8b73ee6 Mon Sep 17 00:00:00 2001 From: "Henrique F. Simoes" Date: Wed, 13 Mar 2024 16:44:25 -0300 Subject: [PATCH] database: add high resolution snapshot and binned stream records. Most cameras have high-throughput when operating with its full resolution. To make it possible to run at higher frame rates when streaming, add new records to enable and disable binning feature and change the resolution correspondingly. Using channel access links to `Acquire` is required here to have the desired effect. Otherwise, sometimes the record won't be reprocessed at the right time (blocking with RPRO=1). This issue has not been further investigated, but has not shown to occur with channel access links. To avoid delays and have explicit support for waiting for record processing, sseq from calc module is used. It should be further investigated if checking for read-back values is more appropriate to ensure the setting is satisfied. Even though the camera firmware knows which value is the updated maximum when applying binning, it does not deliver the image when such parameter is not explicitly reset. Thus, the operation mode switch must enforce this. In a similar vein, GC_{Height,Width}Max_RBV do not update in time when decreasing binning. Thus, use `GC_Sensor{Height,Width}_RBV` instead to avoid empirical delays. Curiously, this does not apply to `$(P)$(R)Stream`. These can possibly be fixed by waiting for read-backs. This has been tested with a Alvium G1-500c. Some features, such as binning mode, may have different names for other devices, which may lead to unexpected behaviours. It should be refactored to use uniform records if another camera is to be supported for this operation mode. A template (cmd) script is provided to make it easier to load such records in a clean way in the main start-up script. --- CameraApp/Db/binned-streaming.db | 58 ++++++++++++++++++++++++++ CameraApp/src/Makefile | 3 ++ iocBoot/iocCamera/binned-streaming.cmd | 8 ++++ 3 files changed, 69 insertions(+) create mode 100644 CameraApp/Db/binned-streaming.db create mode 100644 iocBoot/iocCamera/binned-streaming.cmd diff --git a/CameraApp/Db/binned-streaming.db b/CameraApp/Db/binned-streaming.db new file mode 100644 index 0000000..6c00f68 --- /dev/null +++ b/CameraApp/Db/binned-streaming.db @@ -0,0 +1,58 @@ +# Records for encapusaling logic to change from low resolution (binned) video +# streaming to full resolution single shot capture. + +record(sseq, "$(P)$(R)Snapshot") { + field(DESC, "Capture single image in full resolution") + field(SELM, "All") + field(LNK1, "$(P)$(R)Acquire CA") + field(DO1, "0") + field(WAIT1, "Wait") + field(LNK2, "$(P)$(R)GC_BinningVertical CA") + field(DO2, "1") + field(WAIT2, "Wait") + field(LNK3, "$(P)$(R)GC_BinningHorizontal CA") + field(DO3, "1") + field(WAIT3, "Wait") + field(LNK4, "$(P)$(R)GC_Height CA") + field(DOL4, "$(P)$(R)GC_SensorHeight_RBV CA") + field(WAIT4, "Wait") + field(LNK5, "$(P)$(R)GC_Width CA") + field(DOL5, "$(P)$(R)GC_SensorWidth_RBV CA") + field(WAIT5, "Wait") + field(LNK6, "$(P)$(R)ImageMode CA") + field(DO6, "0") + field(WAIT6, "Wait") + field(LNK8, "$(P)$(R)Acquire CA") + field(DO8, "1") +} + +record(sseq, "$(P)$(R)Stream") { + field(DESC, "Start low resolution (binned) streaming") + field(SELM, "All") + field(LNK1, "$(P)$(R)Acquire CA") + field(DO1, "0") + field(WAIT1, "Wait") + field(LNK2, "$(P)$(R)GC_BinningVertical CA") + field(DO2, "2") + field(WAIT2, "Wait") + field(LNK3, "$(P)$(R)GC_BinningHorizontal CA") + field(DO3, "2") + field(WAIT3, "Wait") + field(LNK4, "$(P)$(R)GC_BinVerticalMode CA") + field(DO4, "1") + field(WAIT4, "Wait") + field(LNK5, "$(P)$(R)GC_BinHorizontalMode CA") + field(DO5, "1") + field(WAIT5, "Wait") + field(LNK6, "$(P)$(R)GC_Height CA") + field(DOL6, "$(P)$(R)GC_HeightMax_RBV CA") + field(WAIT6, "Wait") + field(LNK7, "$(P)$(R)GC_Width CA") + field(DOL7, "$(P)$(R)GC_WidthMax_RBV CA") + field(WAIT7, "Wait") + field(LNK8, "$(P)$(R)ImageMode CA") + field(DO8, "2") + field(WAIT9, "Wait") + field(LNKA, "$(P)$(R)Acquire CA") + field(DOA, "1") +} diff --git a/CameraApp/src/Makefile b/CameraApp/src/Makefile index ce34568..5718988 100644 --- a/CameraApp/src/Makefile +++ b/CameraApp/src/Makefile @@ -17,6 +17,9 @@ Camera_LIBS += ADAravis Camera_DBD += asSupport.dbd Camera_LIBS += autosave +Camera_DBD += sseqRecord.dbd +Camera_LIBS += calc + Camera_SRCS += Camera_registerRecordDeviceDriver.cpp # Build the main IOC entry point on workstation OSs. diff --git a/iocBoot/iocCamera/binned-streaming.cmd b/iocBoot/iocCamera/binned-streaming.cmd new file mode 100644 index 0000000..0556b3a --- /dev/null +++ b/iocBoot/iocCamera/binned-streaming.cmd @@ -0,0 +1,8 @@ +# Load records for binned streaming and high resolution snapshots +# +# Parameters: +# +# $(PREFIX) +# Prefix for all PVs. + +dbLoadRecords("$(TOP)/db/binned-streaming.db", "P=$(PREFIX), R=cam1:")