From 629d181ba6de4644cd0eb4a49fe2f7a975bde787 Mon Sep 17 00:00:00 2001
From: marcofilho <marco.filho@ess.eu>
Date: Fri, 12 Jul 2024 12:15:42 +0200
Subject: [PATCH] Add bo record to set every ST channel all at once.

Before this, you would need to put array of values into ST-S.
Now you can simply put 1 or 0 into AllST-S and it will set all channels.

OOPT "on change" field is needed because for some reason without it even
if you put PINI=NO in all these three ST-S records, it processes on IOC
initialization, which I don't think is desired.
---
 vmmTbl.Makefile              |  2 ++
 vmmTblApp/Db/hybrid.template | 13 +++++++++++++
 2 files changed, 15 insertions(+)

diff --git a/vmmTbl.Makefile b/vmmTbl.Makefile
index 0d1bf87..a480465 100644
--- a/vmmTbl.Makefile
+++ b/vmmTbl.Makefile
@@ -1,6 +1,8 @@
 where_am_I := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
 include $(E3_REQUIRE_TOOLS)/driver.makefile
 
+REQUIRED += calc
+
 APP:=vmmTblApp
 APPDB:=$(APP)/Db
 APPSRC:=$(APP)/src
diff --git a/vmmTblApp/Db/hybrid.template b/vmmTblApp/Db/hybrid.template
index 60cc191..59cb2a3 100644
--- a/vmmTblApp/Db/hybrid.template
+++ b/vmmTblApp/Db/hybrid.template
@@ -46,3 +46,16 @@ record(aao, "$(P)$(R)Hyb$(HYB)ST-S"){
     field(OUT,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))HYB_ST0_SETTER")
 }
 
+record(bo, "$(P)$(R)Hyb$(HYB)AllST-S") {
+    field(DESC, "Set all ST channels")
+    field(VAL,  "0")
+}
+
+record(acalcout, "$(P)$(R)Hyb$(HYB)#AllST-S") {
+    field(NELM, "64")
+    field(CALC, "A=1?1:0")
+    field(OOPT, "On Change")
+    field(INPA, "$(P)$(R)Hyb$(HYB)AllST-S CPP")
+    field(INAA, "$(P)$(R)Hyb$(HYB)ST-S")
+    field(OUT,  "$(P)$(R)Hyb$(HYB)ST-S PP")
+}
-- 
GitLab