simplify status/count update logic
This commit is contained in:
@ -47,7 +47,6 @@ record(ai, "$(P):$(NAME):READALL")
|
||||
{
|
||||
field(DESC, "Reads monitors and elapsed time")
|
||||
field(INP, "@$(PROTO) readAll4($(P):$(NAME):) $(ASYN_PORT)")
|
||||
field(SCAN, ".2 second")
|
||||
field(DTYP, "stream")
|
||||
field(FLNK, "$(P):$(NAME):UNSET-COUNTING")
|
||||
field(FLNK, "$(P):$(NAME):MAP-STATUS")
|
||||
}
|
||||
|
@ -47,9 +47,8 @@ record(ai, "$(P):$(NAME):READALL")
|
||||
{
|
||||
field(DESC, "Reads monitors and elapsed time")
|
||||
field(INP, "@$(PROTO) readAll8($(P):$(NAME):) $(ASYN_PORT)")
|
||||
field(SCAN, ".2 second")
|
||||
field(DTYP, "stream")
|
||||
field(FLNK, "$(P):$(NAME):UNSET-COUNTING")
|
||||
field(FLNK, "$(P):$(NAME):MAP-STATUS")
|
||||
}
|
||||
|
||||
record(longin, "$(P):$(NAME):M5")
|
||||
|
@ -23,7 +23,7 @@ record(fanout, "$(P):$(NAME):INIT-BOX")
|
||||
field(DESC, "Rewrite PVs to Box")
|
||||
field(SELM, "All")
|
||||
field(LNK0, "$(P):$(NAME):MONITOR-CHANNEL_RBV PP")
|
||||
field(LNK1, "$(P):$(NAME):READALL PP")
|
||||
field(LNK1, "$(P):$(NAME):RAW-STATUS PP")
|
||||
field(LNK2, "$(P):$(NAME):THRESHOLD_RBV PP")
|
||||
}
|
||||
|
||||
@ -63,45 +63,17 @@ record(seq, "$(P):$(NAME):REINIT-CONF")
|
||||
field(SELL, "$(P):$(NAME):INVALID-CONFIG.VAL")
|
||||
}
|
||||
|
||||
# The COUNTING PV stays True until Counterbox has switched back to idle mode
|
||||
# and the monitor counts have been read. Therefore, we know that the monitor
|
||||
# values have been updated to represent their final values, when this switches
|
||||
# back to False.
|
||||
#
|
||||
# This is accomplished via the explicit SET-COUNTING and UNSET-COUNTING seq
|
||||
# records, that are triggered by a switch to the counting status
|
||||
# (RAW-STATUS == 1 || 2) and a read of the monitors respectively.
|
||||
record(bi, "$(P):$(NAME):COUNTING")
|
||||
{
|
||||
field(DESC, "Counterbox is Counting")
|
||||
field(VAL, 0)
|
||||
}
|
||||
|
||||
record(seq, "$(P):$(NAME):SET-COUNTING")
|
||||
{
|
||||
field(LNK1, "$(P):$(NAME):COUNTING PP")
|
||||
field(DO1, 1)
|
||||
field(SELM, "Specified")
|
||||
field(SELL, "$(P):$(NAME):MAP-STATUS.VAL")
|
||||
field(FLNK, "$(P):$(NAME):STATUS")
|
||||
}
|
||||
|
||||
record(seq, "$(P):$(NAME):UNSET-COUNTING")
|
||||
{
|
||||
field(LNK0, "$(P):$(NAME):COUNTING PP")
|
||||
field(DO0, 0)
|
||||
field(SELM, "Specified")
|
||||
field(SELL, "$(P):$(NAME):RAW-STATUS.VAL")
|
||||
field(FLNK, "$(P):$(NAME):MAP-STATUS")
|
||||
}
|
||||
|
||||
# Important! The "$(P):$(NAME):READALL" isn't configure with a SCAN. Instead,
|
||||
# it must always be triggered after the value of $(P):$(NAME):RAW-STATUS is
|
||||
# updated, so that it can't be the case that the status changes back from
|
||||
# counting to idle, without having updated the time and count values.
|
||||
record(longin, "$(P):$(NAME):RAW-STATUS")
|
||||
{
|
||||
field(DESC, "Raw returned status value")
|
||||
field(DTYP, "stream")
|
||||
field(SCAN, ".2 second")
|
||||
field(SCAN, ".1 second")
|
||||
field(INP, "@$(PROTO) readStatus($(P):$(NAME):) $(ASYN_PORT)")
|
||||
field(FLNK, "$(P):$(NAME):MAP-STATUS")
|
||||
field(FLNK, "$(P):$(NAME):READALL")
|
||||
}
|
||||
|
||||
record(calc, "$(P):$(NAME):MAP-STATUS")
|
||||
@ -109,9 +81,8 @@ record(calc, "$(P):$(NAME):MAP-STATUS")
|
||||
field(DESC, "Maps Raw Status to State")
|
||||
field(INPA, "$(P):$(NAME):RAW-STATUS NPP")
|
||||
field(INPB, "$(P):$(NAME):INVALID-CONFIG NPP")
|
||||
field(INPC, "$(P):$(NAME):COUNTING NPP")
|
||||
field(CALC, "B=1?4:(C=1&&A=0)||A=1||A=2?1:A=0?0:A=5||A=6?2:A=9||A=13||A=10||A=14?3:4")
|
||||
field(FLNK, "$(P):$(NAME):SET-COUNTING")
|
||||
field(CALC, "B=1?4:A=0?0:(A=1||A=2)?1:(A=5||A=6)?2:(A=9||A=13||A=10||A=14)?3:4")
|
||||
field(FLNK, "$(P):$(NAME):STATUS")
|
||||
}
|
||||
|
||||
record(mbbi, "$(P):$(NAME):STATUS")
|
||||
|
@ -49,9 +49,8 @@ record(ai, "$(P):$(NAME):READALL")
|
||||
{
|
||||
field(DESC, "Reads monitors and elapsed time")
|
||||
field(INP, "@$(PROTO) readAll10($(P):$(NAME):) $(ASYN_PORT)")
|
||||
field(SCAN, ".2 second")
|
||||
field(DTYP, "stream")
|
||||
field(FLNK, "$(P):$(NAME):UNSET-COUNTING")
|
||||
field(FLNK, "$(P):$(NAME):MAP-STATUS")
|
||||
}
|
||||
|
||||
record(longin, "$(P):$(NAME):M5")
|
||||
@ -83,33 +82,3 @@ record(longin, "$(P):$(NAME):M10")
|
||||
{
|
||||
field(DESC, "Counterbox CH10")
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# Testing Commands
|
||||
|
||||
# These won't match the values on the machine after a full restart But I chose
|
||||
# not to force their intialisation as they are only important for testing
|
||||
|
||||
record(bo, "$(P):$(NAME):TESTGEN")
|
||||
{
|
||||
field(DESC, "Turn on/off Testgen Signal")
|
||||
field(DTYP, "stream")
|
||||
field(OUT, "@$(PROTO) switchTestgenOnOff($(P):$(NAME):) $(ASYN_PORT)")
|
||||
field(VAL, 0)
|
||||
}
|
||||
|
||||
record(longout, "$(P):$(NAME):TESTGEN-LOWRATE")
|
||||
{
|
||||
field(DESC, "Set Minimum Testgen Rate")
|
||||
field(DTYP, "stream")
|
||||
field(OUT, "@$(PROTO) setTestSignal($(P):$(NAME):) $(ASYN_PORT)")
|
||||
field(VAL, 1000)
|
||||
}
|
||||
|
||||
record(longout, "$(P):$(NAME):TESTGEN-HIGHRATE")
|
||||
{
|
||||
field(DESC, "Set Maximum Testgen Rate")
|
||||
field(DTYP, "stream")
|
||||
field(OUT, "@$(PROTO) setTestSignal($(P):$(NAME):) $(ASYN_PORT)")
|
||||
field(VAL, 1000)
|
||||
}
|
||||
|
31
db/counterbox_v2_test.db
Normal file
31
db/counterbox_v2_test.db
Normal file
@ -0,0 +1,31 @@
|
||||
################################################################################
|
||||
# Testing Commands
|
||||
|
||||
# These won't match the values on the machine after a full restart But I chose
|
||||
# not to force their intialisation as they are only important for testing
|
||||
|
||||
record(bo, "$(P):$(NAME):TESTGEN")
|
||||
{
|
||||
field(DESC, "Turn on/off Testgen Signal")
|
||||
field(DTYP, "stream")
|
||||
field(OUT, "@$(PROTO) switchTestgenOnOff($(P):$(NAME):) $(ASYN_PORT)")
|
||||
field(VAL, 0)
|
||||
field(ZNAM, "OFF")
|
||||
field(ONAM, "ON")
|
||||
}
|
||||
|
||||
record(longout, "$(P):$(NAME):TESTGEN-LOWRATE")
|
||||
{
|
||||
field(DESC, "Set Minimum Testgen Rate")
|
||||
field(DTYP, "stream")
|
||||
field(OUT, "@$(PROTO) setTestSignal($(P):$(NAME):) $(ASYN_PORT)")
|
||||
field(VAL, 1000)
|
||||
}
|
||||
|
||||
record(longout, "$(P):$(NAME):TESTGEN-HIGHRATE")
|
||||
{
|
||||
field(DESC, "Set Maximum Testgen Rate")
|
||||
field(DTYP, "stream")
|
||||
field(OUT, "@$(PROTO) setTestSignal($(P):$(NAME):) $(ASYN_PORT)")
|
||||
field(VAL, 1000)
|
||||
}
|
Reference in New Issue
Block a user