From 9e495eacfecc94a94fa283a31532d26ec71e6333 Mon Sep 17 00:00:00 2001 From: Sang Woo Kim Date: Mon, 20 Jul 2026 01:27:32 +0900 Subject: [PATCH] NDPluginCircularBuff: writing 0 to SoftTrigger disarms, does not fire writeInt32's NDCircBuffSoftTrigger branch stored the written value and then latched NDCircBuffTriggered=1 and flushed the pre-buffer unconditionally, ignoring the value. The plugin's own vocabulary treats 0 as "off" (the disarm paths clear both SoftTrigger and Triggered to 0), so "caput SoftTrigger 0" -- the natural way to disarm between acquisitions -- fired the trigger instead, and a PINI/autosave restore of SoftTrigger=0 armed the plugin on IOC boot. Guard the trigger latch and pre-buffer flush behind 'if (value)' so only a non-zero write fires the soft trigger. --- ADApp/pluginSrc/NDPluginCircularBuff.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/ADApp/pluginSrc/NDPluginCircularBuff.cpp b/ADApp/pluginSrc/NDPluginCircularBuff.cpp index f1b4ccb0c..5e7bf67c0 100644 --- a/ADApp/pluginSrc/NDPluginCircularBuff.cpp +++ b/ADApp/pluginSrc/NDPluginCircularBuff.cpp @@ -267,14 +267,17 @@ asynStatus NDPluginCircularBuff::writeInt32(asynUser *pasynUser, epicsInt32 valu // Set the parameter in the parameter library. status = (asynStatus) setIntegerParam(function, value); - // Set a soft trigger - setIntegerParam(NDCircBuffTriggered, 1); + // Writing 0 disarms the soft trigger; only a non-zero write fires it. + if (value) { + // Set a soft trigger + setIntegerParam(NDCircBuffTriggered, 1); - epicsInt32 flushOn; - getIntegerParam(NDCircBuffFlushOnSoftTrig, &flushOn); + epicsInt32 flushOn; + getIntegerParam(NDCircBuffFlushOnSoftTrig, &flushOn); - if (flushOn > 0){ - flushPreBuffer(); + if (flushOn > 0){ + flushPreBuffer(); + } } } else if (function == NDCircBuffPreTrigger){