From acf9d75941360b291a7b6e806f68d240c977e755 Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Wed, 19 Mar 2014 16:59:33 +1100 Subject: [PATCH] Change display of values for posit_count, motorhome, and legacy_fsm For hdb and writeTree issues --- site_ansto/motor_dmc2280.c | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/site_ansto/motor_dmc2280.c b/site_ansto/motor_dmc2280.c index c4ac2fb3..b7d732a2 100644 --- a/site_ansto/motor_dmc2280.c +++ b/site_ansto/motor_dmc2280.c @@ -4345,6 +4345,14 @@ static int DMC2280GetPar(void *pData, char *name, *fValue = self->airPollTimer; return 1; } + if(strcasecmp(name,"posit_count") == 0) { + *fValue = self->posit_count; + return 1; + } + if(strcasecmp(name,"motorhome") == 0) { + *fValue = self->motorhome; + return 1; + } if (self->posit_count > 0) { if (strncasecmp(name, "posit_", 6) == 0 && isdigit(name[6])) { int index; @@ -4774,6 +4782,23 @@ static int DMC2280SetPar(void *pData, SConnection *pCon, return 1; } } + if(strcasecmp(name, "motorhome") == 0) { + /* Debug Managers only */ + if(!SCMatchRights(pCon,usInternal)) + return 1; + else { + if ( (self->fLower - newValue) > FLT_EPSILON) { + snprintf(pError, ERRLEN,"WARNING:'%s %s' is lower than the lower limit %f", self->name, HOME, self->fLower); + SCWrite(pCon, pError, eWarning); + } + if ( (newValue - self->fUpper) > FLT_EPSILON) { + snprintf(pError, ERRLEN,"WARNING:'%s %s' is greater than the upper limit %f", self->name, HOME, self->fUpper); + SCWrite(pCon, pError, eWarning); + } + self->motorhome = newValue; + return 1; + } + } if (self->posit_count > 0) { int index; @@ -4799,6 +4824,7 @@ static void DMC2280StrList(pDMC2280Driv self, char *name, SConnection *pCon){ SCPrintf(pCon, eStatus, "%s.part = %s\n", name, self->part); SCPrintf(pCon, eStatus, "%s.long_name = %s\n", name, self->long_name); SCPrintf(pCon, eStatus, "%s.axis = %c\n", name, self->axisLabel); + SCPrintf(pCon, eStatus, "%s.legacy_fsm = %s\n", name, self->legacy_fsm ? "ON" : "OFF"); if (self->encoderAxis) { SCPrintf(pCon, eStatus, "%s.encoderAxis = %c\n", name, self->encoderAxis); } @@ -4849,7 +4875,6 @@ static void DMC2280List(void *pData, char *name, SConnection *pCon){ SCPrintf(pCon, eStatus, "%s.Blockage_Fail = %d\n", name, self->blockage_fail); SCPrintf(pCon, eStatus, "%s.Backlash_offset = %f\n", name, self->backlash_offset); SCPrintf(pCon, eStatus, "%s.Protocol = %d\n", name, self->protocol); - SCPrintf(pCon, eStatus, "%s.Legacy_FSM = %s\n", name, self->legacy_fsm ? "ON" : "OFF"); SCPrintf(pCon, eStatus, "%s.absEncoder = %d\n", name, self->abs_encoder); if (self->abs_encoder) { SCPrintf(pCon, eStatus, "%s.absEncHome = %d\n", name, self->absEncHome); @@ -5893,6 +5918,14 @@ int DMC2280Action(SConnection *pCon, SicsInterp *pSics, void *pData, SCWrite(pCon, line, eValue); return 1; } + else if(strcasecmp("legacy_fsm", argv[1]) == 0) { + SCPrintf(pCon, eValue, "%s.legacy_fsm = %d", self->name, self->posit_count); + return 1; + } + else if(strcasecmp("posit_count", argv[1]) == 0) { + SCPrintf(pCon, eValue, "%s.posit_count = %d", self->name, self->posit_count); + return 1; + } else if(strcasecmp("positions", argv[1]) == 0) { if (argc == 2) { int i, k = 0;