Commit 605fb10b authored by kpetersn's avatar kpetersn
Browse files

Added checks for controller and stage config before sending LNP commands.

parent 18e8f4e7
......@@ -77,7 +77,7 @@ record(bo, "$(P)$(T):heating")
field(PINI, "YES")
field(ZNAM, "Off")
field(ONAM, "On")
field(VAL, "0")
field(VAL, "Off")
}
record(bo, "$(P)$(T):lnpMode")
......@@ -87,7 +87,7 @@ record(bo, "$(P)$(T):lnpMode")
field(PINI, "YES")
field(ZNAM, "Manual")
field(ONAM, "Auto")
field(VAL, "1")
field(VAL, "Auto")
}
record(longout, "$(P)$(T):lnpSpeed")
......@@ -96,11 +96,11 @@ record(longout, "$(P)$(T):lnpSpeed")
field(OUT, "@asyn($(PORT),$(ADDR))LNP_SPEED_OUT_VALUE")
field(PINI, "YES")
field(OMSL, "closed_loop")
field(DRVH, "100")
field(DRVL, "0")
field(VAL, "0")
field(HOPR, "100")
field(LOPR, "0")
field(DRVH, 100)
field(DRVL, 0)
field(VAL, 0)
field(HOPR, 100)
field(LOPR, 0)
field(EGU, "%")
}
......
......@@ -34,6 +34,7 @@ Linkam::Linkam(const char *portName, const epicsUInt32 commType, const epicsUInt
createParam(heaterPowerInValueString, asynParamFloat64, &heaterPowerInValue_);
createParam(heatingOutValueString, asynParamInt32, &heatingOutValue_);
createParam(lnpModeOutValueString, asynParamInt32, &lnpModeOutValue_);
createParam(lnpSpeedOutValueString, asynParamInt32, &lnpSpeedOutValue_);
createParam(controllerConfigInValueString, asynParamInt32, &controllerConfigInValue_);
createParam(controllerErrorInValueString, asynParamInt32, &controllerErrorInValue_);
createParam(controllerStatusInValueString, asynParamInt32, &controllerStatusInValue_);
......@@ -354,12 +355,12 @@ asynStatus Linkam::writeInt32(asynUser *pasynUser, epicsInt32 value)
} else if (function == lnpModeOutValue_) {
// Set Manual/Auto LNP mode
status = setLnpMode(value);
status = setLnpMode(pasynUser, value);
} else if (function == lnpSpeedOutValue_) {
// Set LN pump speed (0-100%)
status = setLnpSpeed(value);
status = setLnpSpeed(pasynUser, value);
}
......@@ -393,14 +394,52 @@ asynStatus Linkam::setHeating(epicsInt32 value)
return (status) ? asynSuccess : asynError;
}
asynStatus Linkam::setLnpMode(epicsInt32 value)
asynStatus Linkam::setLnpMode(asynUser *pasynUser, epicsInt32 value)
{
bool status;
static const char *functionName = "setLnpMode";
this->lock();
if (controllerLnpReady_)
{
if (value == 1)
{
// User requested Auto mode
if (stageLnpAuto_ == 1)
{
status = SetLnpMode(true);
} else {
status = false;
asynPrint(pasynUser, ASYN_TRACE_ERROR,
"%s:%s, port %s, ERROR setting LNP Mode: stageLnpAuto_ = %d\n",
driverName, functionName, this->portName, stageLnpAuto_);
}
} else {
// User requested Manual mode
if (stageLnpManual_ == 1)
{
status = SetLnpMode(false);
} else {
status = false;
asynPrint(pasynUser, ASYN_TRACE_ERROR,
"%s:%s, port %s, ERROR setting LNP Mode: stageLnpManual_ = %d\n",
driverName, functionName, this->portName, stageLnpManual_);
}
}
} else {
status = false;
asynPrint(pasynUser, ASYN_TRACE_ERROR,
"%s:%s, port %s, ERROR setting LNP Mode: controllerLnpReady_ = %d\n",
driverName, functionName, this->portName, controllerLnpReady_);
}
// Manual = 0 = false ; Auto = 1 = true
status = SetLnpMode((value==1) ? true : false);
//status = SetLnpMode((value==1) ? true : false);
this->unlock();
asynPrint(this->pasynUserSelf, ASYN_TRACEIO_DRIVER,
......@@ -410,15 +449,38 @@ asynStatus Linkam::setLnpMode(epicsInt32 value)
return (status) ? asynSuccess : asynError;
}
asynStatus Linkam::setLnpSpeed(epicsInt32 value)
asynStatus Linkam::setLnpSpeed(asynUser *pasynUser, epicsInt32 value)
{
bool status;
static const char *functionName = "setLnpSpeed";
this->lock();
if (controllerLnpReady_)
{
// 0-100%
if (stageLnpManual_ == 1)
{
status = SetLnpSpeed(value);
} else {
status = false;
asynPrint(pasynUser, ASYN_TRACE_ERROR,
"%s:%s, port %s, ERROR setting LNP Speed: stageLnpManual_ = %d\n",
driverName, functionName, this->portName, stageLnpManual_);
}
} else {
status = false;
asynPrint(pasynUser, ASYN_TRACE_ERROR,
"%s:%s, port %s, ERROR setting LNP Speed: controllerLnpReady_ = %d\n",
driverName, functionName, this->portName, controllerLnpReady_);
}
// 0-100%
status = SetLnpMode(value);
this->unlock();
//status = SetLnpMode(value);
this->unlock();
asynPrint(this->pasynUserSelf, ASYN_TRACEIO_DRIVER,
"%s:%s, port %s, value = %d\n",
......@@ -427,6 +489,7 @@ asynStatus Linkam::setLnpSpeed(epicsInt32 value)
return (status) ? asynSuccess : asynError;
}
asynStatus Linkam::readInt32(asynUser *pasynUser, epicsInt32 *value)
{
int function = pasynUser->reason;
......
......@@ -99,8 +99,8 @@ private:
asynStatus setRampRate(epicsFloat64 value);
asynStatus readHeaterPower(epicsFloat64 *value);
asynStatus setHeating(epicsInt32 value);
asynStatus setLnpMode(epicsInt32 value);
asynStatus setLnpSpeed(epicsInt32 value);
asynStatus setLnpMode(asynUser *pasynUser, epicsInt32 value);
asynStatus setLnpSpeed(asynUser *pasynUser, epicsInt32 value);
asynStatus readControllerConfig();
asynStatus readControllerError();
asynStatus readControllerStatus();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment