initial version of parameter table
This commit is contained in:
@@ -11,6 +11,7 @@ include $(TOP)/configure/CONFIG
|
||||
# Create and install (or just install) into <top>/db
|
||||
# databases, templates, substitutions like this
|
||||
DB += test.db
|
||||
DB += test6.db
|
||||
|
||||
#----------------------------------------------------
|
||||
# If <anyname>.db template is not named <anyname>*.template add
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
record(ao, "$(P):A") {
|
||||
field(DTYP, "Python Device")
|
||||
field(OUT , "@devsup.ptable $(TNAME) A")
|
||||
}
|
||||
|
||||
record(ao, "$(P):B") {
|
||||
field(DTYP, "Python Device")
|
||||
field(OUT , "@devsup.ptable $(TNAME) B")
|
||||
}
|
||||
|
||||
record(ao, "$(P):C") {
|
||||
field(DTYP, "Python Device")
|
||||
field(OUT , "@$(TNAME) C")
|
||||
info("pySupportMod", "devsup.ptable")
|
||||
}
|
||||
|
||||
record(ai, "$(P):S") {
|
||||
field(DTYP, "Python Device")
|
||||
field(INP , "@devsup.ptable $(TNAME) S")
|
||||
field(SCAN, "I/O Intr")
|
||||
field(PINI, "YES")
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import logging
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
import devsup.ptable as PT
|
||||
|
||||
class SumTable(PT.TableBase):
|
||||
A = PT.Parameter()
|
||||
B = PT.Parameter()
|
||||
C = PT.Parameter()
|
||||
S = PT.Parameter(iointr=True)
|
||||
|
||||
inputs = PT.ParameterGroup([A,B])
|
||||
|
||||
@C.onchange
|
||||
def newC(self):
|
||||
LOG.debug("C is %s", self.C.value)
|
||||
|
||||
@inputs.anynotvalid
|
||||
def inval(self):
|
||||
print self.A.isvalid, self.B.isvalid
|
||||
LOG.debug("%s.update inputs not valid", self.name)
|
||||
self.S.value = None
|
||||
self.S.notify()
|
||||
|
||||
@inputs.allvalid
|
||||
def update(self):
|
||||
if not all(map(lambda P:P.isvalid, [self.A, self.B])):
|
||||
self.inval()
|
||||
return
|
||||
self.S.value = self.A.value + self.B.value
|
||||
LOG.debug("%s.S = %s", self.name, self.S.value)
|
||||
self.S.notify()
|
||||
Reference in New Issue
Block a user