added scan entry to enable monitoring; added commented sync command as alternative

This commit is contained in:
2023-04-11 12:19:03 +02:00
parent 2bd2dbd39f
commit 42c48ab548
2 changed files with 22 additions and 1 deletions
+10
View File
@@ -32,4 +32,14 @@ class AdjustableDriver(Driver):
return value
# def sync(self):
# for n, a in self.adjs.items():
# v_adj = a.get_current_value()
# v_par = self.getParam(n)
# if v_adj != v_par:
# print("sync:", n, v_adj)
# self.setParam(n, v_adj)
# self.updatePVs() # this actually triggers the monitoring
+12 -1
View File
@@ -1,3 +1,4 @@
import pcaspy
from pcaspy import SimpleServer
from pcaspy.tools import ServerThread
from .adjdrv import AdjustableDriver
@@ -36,13 +37,23 @@ class IOC(ServerThread):
super().__init__(server)
# def run(self):
# while self.running:
# self.server.process(0.1)
# self.driver.sync()
def mk_pvdb(adjs):
return {n: mk_pvinfo(a) for n, a in adjs.items()}
def mk_pvinfo(adj):
typ = infer_type(adj)
return {"type": typ}
res = {
"type": typ,
"scan": 1 # triggers monitors every second
}
return res
def infer_type(adj):
val = adj.get_current_value()