chore: add callback PV to template
This commit is contained in:
+9
-3
@@ -43,7 +43,9 @@ class PVs(BasePVs):
|
||||
|
||||
# TODO: class attribute names usually lowercase
|
||||
# usually it is advisable to trigger the mainloop of a service on changes of certain PVs:
|
||||
self.CallbackPV = PV("...", auto_monitor=dbr.DBE_VALUE)
|
||||
self.CallbackPV = PV(
|
||||
"AGEBD-{{ service_name_upper }}:CALLBACK", auto_monitor=dbr.DBE_VALUE
|
||||
) # TODO: ok?
|
||||
|
||||
|
||||
class Service(BaseService[PVs]):
|
||||
@@ -77,13 +79,17 @@ class Service(BaseService[PVs]):
|
||||
#######################################################################################
|
||||
# here goes all the code that your service
|
||||
# is supposed to be running in any case, e.g.,
|
||||
|
||||
# update some pvs/vals
|
||||
self.pvs.my_pv1.put("MY_PV1 value")
|
||||
self.pvs.my_pv2.put("MY_PV2 value")
|
||||
# self.pvs.my_pv1.put("MY_PV1 value")
|
||||
# self.pvs.my_pv2.put("MY_PV2 value")
|
||||
|
||||
# get some pvs/vals
|
||||
self.val1 = self.pvs.my_pv1.get()
|
||||
self.val2 = self.pvs.my_pv2.get()
|
||||
print(self.val1)
|
||||
print(self.val2)
|
||||
|
||||
# maybe sleep to limit the update loop execution rate
|
||||
sleep(1)
|
||||
#######################################################################################
|
||||
|
||||
+10
@@ -24,4 +24,14 @@ record(bo, "$(DEVICE):BO") {
|
||||
field(OSV, "NO_ALARM")
|
||||
field(VAL, "1")
|
||||
field(PINI, "YES")
|
||||
}
|
||||
|
||||
# TODO: ok?
|
||||
record(bo, "$(DEVICE):CALLBACK") {
|
||||
field(DESC, "Callback PV to listen to for changes")
|
||||
field(ASG, "READONLY")
|
||||
field(ZSV, "MINOR")
|
||||
field(OSV, "NO_ALARM")
|
||||
field(VAL, "1")
|
||||
field(PINI, "YES")
|
||||
}
|
||||
Reference in New Issue
Block a user