Feature: add SIMM=RAW to ao records
This commit is contained in:
@@ -37,7 +37,7 @@
|
||||
#include "recGbl.h"
|
||||
#include "menuConvert.h"
|
||||
#include "menuOmsl.h"
|
||||
#include "menuYesNo.h"
|
||||
#include "menuSimm.h"
|
||||
#include "menuIvoa.h"
|
||||
|
||||
#define GEN_SIZE_OFFSET
|
||||
@@ -561,15 +561,24 @@ static long writeValue(aoRecord *prec)
|
||||
}
|
||||
|
||||
switch (prec->simm) {
|
||||
case menuYesNoNO:
|
||||
case menuSimmNO:
|
||||
status = pdset->write_ao(prec);
|
||||
break;
|
||||
|
||||
case menuYesNoYES: {
|
||||
case menuSimmYES:
|
||||
case menuSimmRAW:
|
||||
{
|
||||
recGblSetSevr(prec, SIMM_ALARM, prec->sims);
|
||||
if (prec->pact || (prec->sdly < 0.)) {
|
||||
status = dbPutLink(&prec->siol, DBR_DOUBLE, &prec->oval, 1);
|
||||
prec->pact = FALSE;
|
||||
if (prec->pact || (prec->sdly < 0.)) {
|
||||
if(prec->simm == menuSimmYES){
|
||||
/* don't convert */
|
||||
status = dbPutLink(&prec->siol, DBR_DOUBLE, &prec->oval, 1);
|
||||
}
|
||||
else { /* prec->simm == menuSimmRAW*/
|
||||
/* convert */
|
||||
status = dbPutLink(&prec->siol, DBR_LONG, &prec->rval, 1);
|
||||
}
|
||||
prec->pact = FALSE;
|
||||
} else { /* !prec->pact && delay >= 0. */
|
||||
epicsCallback *pvt = prec->simpvt;
|
||||
if (!pvt) {
|
||||
|
||||
@@ -263,7 +263,7 @@ processing.
|
||||
|
||||
The following fields are used to operate the record in simulation mode.
|
||||
|
||||
If SIMM (fetched through SIML) is YES, the record is put in SIMS
|
||||
If SIMM (fetched through SIML, if populated) is YES, the record is put in SIMS
|
||||
severity and the value is written through SIOL, without conversion.
|
||||
SSCN sets a different SCAN mechanism to use in simulation mode.
|
||||
SDLY sets a delay (in sec) that is used for asynchronous simulation
|
||||
@@ -557,7 +557,7 @@ for more information on simulation mode and its fields.
|
||||
prompt("Simulation Mode")
|
||||
special(SPC_MOD)
|
||||
interest(1)
|
||||
menu(menuYesNo)
|
||||
menu(menuSimm)
|
||||
}
|
||||
field(SIMS,DBF_MENU) {
|
||||
prompt("Simulation Mode Severity")
|
||||
|
||||
@@ -63,6 +63,7 @@ static char *rawSupp[] = {
|
||||
"bi",
|
||||
"mbbi",
|
||||
"mbbiDirect",
|
||||
"ao"
|
||||
};
|
||||
|
||||
static
|
||||
@@ -77,6 +78,7 @@ int hasRawSimmSupport(const char *rectype) {
|
||||
static char nameVAL[PVNAMELENGTH];
|
||||
static char nameB0[PVNAMELENGTH];
|
||||
static char nameRVAL[PVNAMELENGTH];
|
||||
static char nameROFF[PVNAMELENGTH];
|
||||
static char nameSGNL[PVNAMELENGTH];
|
||||
static char nameSIMM[PVNAMELENGTH];
|
||||
static char nameSIML[PVNAMELENGTH];
|
||||
@@ -98,7 +100,7 @@ static char nameSimvalLEN[PVNAMELENGTH];
|
||||
static
|
||||
void setNames(const char *name)
|
||||
{
|
||||
SETNAME(VAL); SETNAME(B0); SETNAME(RVAL); SETNAME(SGNL);
|
||||
SETNAME(VAL); SETNAME(B0); SETNAME(RVAL); SETNAME(ROFF); SETNAME(SGNL);
|
||||
SETNAME(SVAL); SETNAME(SIMM); SETNAME(SIML); SETNAME(SIOL); SETNAME(SIMS);
|
||||
SETNAME(SCAN); SETNAME(PROC); SETNAME(PACT);
|
||||
SETNAME(STAT); SETNAME(SEVR); SETNAME(TSE);
|
||||
@@ -399,6 +401,18 @@ void testSiolWrite(const char *name,
|
||||
testdbPutFieldOk(nameVAL, DBR_LONG, 1);
|
||||
testdbGetFieldEqual(nameSimval, DBR_USHORT, 1);
|
||||
|
||||
if(hasRawSimmSupport(name)){
|
||||
testDiag("in simmRAW, RVAL should be written to SIOL");
|
||||
testDiag("SIML overrides SIMM, disable it here");
|
||||
testdbPutFieldOk(nameSIML, DBR_STRING, "");
|
||||
testdbPutFieldOk(nameSIMM, DBR_STRING, "RAW");
|
||||
testdbPutFieldOk(nameROFF, DBR_ULONG, 2);
|
||||
testdbPutFieldOk(nameVAL, DBR_DOUBLE, 5.);
|
||||
testdbGetFieldEqual(nameRVAL, DBR_LONG, 3);
|
||||
testdbGetFieldEqual(nameSimval, DBR_DOUBLE, 3.);
|
||||
testdbPutFieldOk(nameSIML, DBR_STRING, nameSimmode);
|
||||
}
|
||||
|
||||
/* Set TSE to -2 (from device) and reprocess: timestamp is taken from IOC */
|
||||
epicsTimeGetCurrent(&now);
|
||||
testdbPutFieldOk(nameTSE, DBR_SHORT, -2);
|
||||
@@ -502,7 +516,7 @@ void testAllRecTypes(void)
|
||||
|
||||
MAIN(simmTest)
|
||||
{
|
||||
testPlan(1176);
|
||||
testPlan(1219);
|
||||
startSimmTestIoc("simmTest.db");
|
||||
|
||||
testSimmSetup();
|
||||
|
||||
Reference in New Issue
Block a user