Skip to content

Commit

Permalink
Add OUT field
Browse files Browse the repository at this point in the history
Now that we have static output value type, it makes sense to have an OUT
field.
  • Loading branch information
klemenv committed Jan 1, 2022
1 parent a1d42f7 commit fc40ef1
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pycalcRecord.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ record processes unless Python code could not be executed. The result
value is converted to the type specified in FTVL which can be one of the
following: LONG, DOUBLE, STRING.

If an output link is specified in OUT field, the same value from VAL is
sent to the output link.

### Python expression
The purpose of this record is to be able to execute arbitrary Python code
by passing multiple parameters from EPICS PVs. The actual code to be executed
Expand Down
1 change: 1 addition & 0 deletions src/pycalcRecord.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ static long processRecord(dbCommon *common)
}

recGblGetTimeStamp(rec);
dbPutLink(&rec->out, rec->ftvl, rec->val, 1);

auto monitor_mask = recGblResetAlarms(rec);
if (rec->ctx->processCbStatus == -1) {
Expand Down
4 changes: 4 additions & 0 deletions src/pycalcRecord.dbd
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ recordtype(pycalc) {
initial("DOUBLE")
menu(menuFtype)
}
field(OUT,DBF_OUTLINK) {
prompt("Output Specification")
interest(1)
}

field(INPA,DBF_INLINK) {
prompt("Input Link A")
Expand Down
4 changes: 4 additions & 0 deletions testApp/Db/pycalcrectest.db
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ record(ai, "PyCalcTest:Input1") {
record(ai, "PyCalcTest:Input2") {
field(INP, "6.4")
}
record(longin, "PyCalcTest:Output") {
field(VAL, "-1")
}
record(pycalc, "PyCalcTest:MathExpr") {
field(INPA, "17")
field(INPB, "3")
Expand All @@ -16,6 +19,7 @@ record(pycalc, "PyCalcTest:AdaptiveTypes") {
field(FTB, "DOUBLE")
field(CALC, "pow(max([A, B]), 2)")
field(FTVL, "LONG")
field(OUT, "PyCalcTest:Output PP")
}
record(pycalc, "PyCalcTest:InvalidAlarm") {
field(CALC, "unknown_function()")
Expand Down

0 comments on commit fc40ef1

Please sign in to comment.