From 8200d1b9fcde8784eba37786cb9a638a577fc386 Mon Sep 17 00:00:00 2001 From: Freddie Akeroyd Date: Mon, 8 Jun 2026 11:05:08 +0100 Subject: [PATCH] Try to avoid race condition on startup --- GalilSup/Db/galil_ctrl_extras.template | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/GalilSup/Db/galil_ctrl_extras.template b/GalilSup/Db/galil_ctrl_extras.template index d0d4dc4..e764567 100644 --- a/GalilSup/Db/galil_ctrl_extras.template +++ b/GalilSup/Db/galil_ctrl_extras.template @@ -435,7 +435,11 @@ record(ao,"$(P):PWRDET:SP") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)USER_VAR pwrdet") field(SCAN, "Passive") + # set a default non-zero as zero in galil is a problem + # and is never a test value + field(VAL, "2") info(autosaveFields_pass0, "VAL") + info(archive, "VAL") } record(ai,"$(P):PWRDET") { @@ -443,7 +447,9 @@ record(ai,"$(P):PWRDET") { field(DTYP, "asynFloat64") field(INP, "@asyn($(PORT),0)USER_VAR pwrdet") field(SCAN, "10 second") + field(SDIS, "$(P):PWRDET:SP.PACT") field(FLNK, "$(P):PWRDET:ALERT.PROC") + info(archive, "VAL") } ## 0 = ok, 1 = problem @@ -454,7 +460,7 @@ record(calcout,"$(P):PWRDET:ALERT") { field(INPB, "$(P):PWRDET:SP") field(CALC, "A!=B") field(OOPT, "When Zero") - field(OUT, "$(P):PWRDET:TIMER.PROC") + field(OUT, "$(P):PWRDET:TIMER.PROC PP") info(archive, "VAL") } @@ -466,12 +472,16 @@ record(bo,"$(P):PWRDET:RESET:SP") { } ## how often we should set a new test value -## A % 360 means 3600 seconds as we are on 10 second scan link +## A = 360 means 3600 seconds as we are on 10 second scan link +## Changing value is only a check in case it got saved into galil +## firmware so changing this once per ioc run is fine +## make sure we don't set a new value too soon +## after ioc startup in case of a quick restart causing a race condition record(calcout, "$(P):PWRDET:TIMER") { field(DESC, "Set new PWRDET test value") - field(CALC, "A % 360; A := A + 1") + field(CALC, "A = 360; A := A + 1") field(INPA, "0") - field(OOPT, "When Zero") + field(OOPT, "When Non-zero") field(DOPT, "Use OCAL") field(OCAL, "CEIL(RNDM*100)+1") field(OUT, "$(P):PWRDET:SP PP")