Commit 7c72d958 authored by kpetersn's avatar kpetersn
Browse files

Added controller and stage queries for troubleshooting. They don't work as expected yet.

parent 487c2315
......@@ -79,3 +79,39 @@ record(bo, "$(P)$(T):heating")
field(ONAM, "On")
field(VAL, "0")
}
record(longin, "$(P)$(T):controllerConfig_RBV")
{
field(DTYP, "asynInt32")
field(INP, "@asyn($(PORT),$(ADDR))CONTROLLER_CONFIG_IN_VALUE")
field(PINI, "YES")
field(EGU, "N/A")
field(SCAN, "Passive")
}
record(longin, "$(P)$(T):controllerError_RBV")
{
field(DTYP, "asynInt32")
field(INP, "@asyn($(PORT),$(ADDR))CONTROLLER_CONFIG_IN_VALUE")
field(PINI, "YES")
field(EGU, "N/A")
field(SCAN, "Passive")
}
record(longin, "$(P)$(T):controllerStatus_RBV")
{
field(DTYP, "asynInt32")
field(INP, "@asyn($(PORT),$(ADDR))CONTROLLER_CONFIG_IN_VALUE")
field(PINI, "YES")
field(EGU, "N/A")
field(SCAN, "Passive")
}
record(longin, "$(P)$(T):stageConfig_RBV")
{
field(DTYP, "asynInt32")
field(INP, "@asyn($(PORT),$(ADDR))CONTROLLER_CONFIG_IN_VALUE")
field(PINI, "YES")
field(EGU, "N/A")
field(SCAN, "Passive")
}
\ No newline at end of file
......@@ -33,6 +33,10 @@ Linkam::Linkam(const char *portName, const epicsUInt32 commType, const epicsUInt
createParam(rampRateInValueString, asynParamFloat64, &rampRateInValue_);
createParam(heaterPowerInValueString, asynParamFloat64, &heaterPowerInValue_);
createParam(heatingOutValueString, asynParamInt32, &heatingOutValue_);
createParam(controllerConfigInValueString, asynParamInt32, &controllerConfigInValue_);
createParam(controllerErrorInValueString, asynParamInt32, &controllerErrorInValue_);
createParam(controllerStatusInValueString, asynParamInt32, &controllerStatusInValue_);
createParam(stageConfigInValueString, asynParamInt32, &stageConfigInValue_);
// Must be in the directory with the DLL when this line is executed
//LoadMonoLibrary("LinkamCommsDll.dll");
......@@ -372,13 +376,129 @@ asynStatus Linkam::setHeating(epicsInt32 value)
return (status) ? asynSuccess : asynError;
}
asynStatus Linkam::readInt32(asynUser *pasynUser, epicsInt32 *value)
{
int function = pasynUser->reason;
asynStatus status = asynSuccess;
static const char *functionName = "readInt32";
asynPrint(pasynUser, ASYN_TRACEIO_DRIVER,
"%s:%s, port %s, function = %d\n",
driverName, functionName, this->portName, function);
// Get the current value; it can be reverted later if commands fail
getIntegerParam(function, value);
if (function == controllerConfigInValue_) {
status = readControllerConfig(&controllerConfig_);
} else if (function == controllerErrorInValue_) {
status = readControllerError(&controllerError_);
} else if (function == controllerStatusInValue_) {
status = readControllerStatus(&controllerStatus_);
} else if (function == stageConfigInValue_) {
status = readStageConfig(&stageConfig_);
}
// Increment the value so we can see that records are processing
if (*value > 100000)
*value = 0;
else
*value += 1;
callParamCallbacks();
if (status == 0) {
asynPrint(pasynUser, ASYN_TRACEIO_DRIVER,
"%s:%s, port %s, wrote %d\n",
driverName, functionName, this->portName, value);
} else {
asynPrint(pasynUser, ASYN_TRACE_ERROR,
"%s:%s, port %s, ERROR writing %d, status=%d\n",
driverName, functionName, this->portName, value, status);
}
return (status==0) ? asynSuccess : asynError;
}
asynStatus Linkam::readControllerConfig(epicsUInt64 *value)
{
static const char *functionName = "readControllerConfig";
this->lock();
*value = GetControllerConfig();
this->unlock();
asynPrint(this->pasynUserSelf, ASYN_TRACEIO_DRIVER,
"%s:%s, port %s, value = %llx\n",
driverName, functionName, this->portName, *value);
return asynSuccess;
}
asynStatus Linkam::readControllerError(epicsUInt32 *value)
{
static const char *functionName = "readControllerError";
this->lock();
*value = GetControllerError();
this->unlock();
asynPrint(this->pasynUserSelf, ASYN_TRACEIO_DRIVER,
"%s:%s, port %s, value = %lx\n",
driverName, functionName, this->portName, *value);
return asynSuccess;
}
asynStatus Linkam::readControllerStatus(epicsUInt64 *value)
{
static const char *functionName = "readControllerStatus";
this->lock();
*value = GetStatus();
this->unlock();
asynPrint(this->pasynUserSelf, ASYN_TRACEIO_DRIVER,
"%s:%s, port %s, value = %llx\n",
driverName, functionName, this->portName, *value);
return asynSuccess;
}
asynStatus Linkam::readStageConfig(epicsUInt64 *value)
{
static const char *functionName = "readStageConfig";
this->lock();
*value = GetStageConfig();
this->unlock();
asynPrint(this->pasynUserSelf, ASYN_TRACEIO_DRIVER,
"%s:%s, port %s, value = %llx\n",
driverName, functionName, this->portName, *value);
return asynSuccess;
}
void Linkam::report(FILE *fp, int details)
{
asynPortDriver::report(fp, details);
fprintf(fp, "* Port: %s, commType=%d, commPort=%d, commStatus=%d\n", this->portName, commType_, commPort_, commStatus_);
if (details >= 1)
fprintf(fp, " interesting value = ");
{
fprintf(fp, " controller config = %llx\n", controllerConfig_);
fprintf(fp, " controller error = %lx\n", controllerError_);
fprintf(fp, " controller status = %llx\n", controllerStatus_);
fprintf(fp, " stage config = %llx\n", stageConfig_);
}
fprintf(fp, "\n");
}
......
......@@ -26,6 +26,10 @@ static const char *driverName = "Linkam";
#define rampRateInValueString "RAMP_RATE_IN_VALUE" /* asynFloat64 r/o */
#define heaterPowerInValueString "HEATER_POWER_IN_VALUE" /* asynFloat64 r/o */
#define heatingOutValueString "HEATING_OUT_VALUE" /* asynInt32 r/w */
#define controllerConfigInValueString "CONTROLLER_CONFIG_IN_VALUE" /* asynInt32 r/o */
#define controllerErrorInValueString "CONTROLLER_ERROR_IN_VALUE" /* asynInt32 r/o */
#define controllerStatusInValueString "CONTROLLER_STATUS_IN_VALUE" /* asynInt32 r/o */
#define stageConfigInValueString "STAGE_CONFIG_IN_VALUE" /* asynInt32 r/o */
/*
* Class definition for the Linkam class
......@@ -36,6 +40,7 @@ public:
/* These are the methods that we override from asynPortDriver */
virtual asynStatus writeInt32(asynUser *pasynUser, epicsInt32 value);
virtual asynStatus readInt32(asynUser *pasynUser, epicsInt32 *value);
virtual asynStatus readFloat64(asynUser *pasynUser, epicsFloat64 *value);
virtual asynStatus writeFloat64(asynUser *pasynUser, epicsFloat64 value);
virtual asynStatus disconnect(asynUser *pasynUser);
......@@ -50,8 +55,12 @@ protected:
int rampRateInValue_;
int heaterPowerInValue_;
int heatingOutValue_;
int controllerConfigInValue_;
int controllerErrorInValue_;
int controllerStatusInValue_;
int stageConfigInValue_;
#define FIRST_LINKAM_PARAM temperatureInValue_;
#define LAST_LINKAM_PARAM heatingOutValue_;
#define LAST_LINKAM_PARAM stageConfigInValue_;
private:
asynStatus readTemperature(epicsFloat64 *value);
......@@ -61,6 +70,10 @@ private:
asynStatus setRampRate(epicsFloat64 value);
asynStatus readHeaterPower(epicsFloat64 *value);
asynStatus setHeating(epicsInt32 value);
asynStatus readControllerConfig(epicsUInt64 *value);
asynStatus readControllerError(epicsUInt32 *value);
asynStatus readControllerStatus(epicsUInt64 *value);
asynStatus readStageConfig(epicsUInt64 *value);
void report(FILE *fp, int details);
epicsUInt32 commType_;
......@@ -69,6 +82,10 @@ private:
float temperatureRbv_;
char* wrapperVersion_;
char* libraryVersion_;
epicsUInt64 controllerConfig_;
epicsUInt32 controllerError_;
epicsUInt64 controllerStatus_;
epicsUInt64 stageConfig_;
};
#define NUM_PARAMS ((int)(&LAST_LINKAM_PARAM - &FIRST_LINKAM_PARAM + 1))
......
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