Only allow managers to set hard limits and home position.
r1085 | ffr | 2006-08-27 15:43:51 +1000 (Sun, 27 Aug 2006) | 2 lines
This commit is contained in:
committed by
Douglas Clowes
parent
ba27774e4a
commit
ffd898cf16
@@ -727,6 +727,7 @@ static int DMC2280GetPar(void *pData, char *name,
|
||||
|
||||
self = (pDMC2280Driv)pData;
|
||||
|
||||
/* XXX Maybe move this to a configuration parameter.*/
|
||||
if(strcmp(name,HOME) == 0) {
|
||||
*fValue = self->home;
|
||||
return 1;
|
||||
@@ -787,30 +788,43 @@ static int DMC2280SetPar(void *pData, SConnection *pCon,
|
||||
|
||||
self = (pDMC2280Driv)pData;
|
||||
|
||||
/* Set home */
|
||||
/* XXX Maybe move this to a configuration parameter.*/
|
||||
/* Set home, managers only. Users should set softposition */
|
||||
if(strcmp(name,HOME) == 0) {
|
||||
if ( (self->fLower - newValue) > FLT_EPSILON) {
|
||||
snprintf(pError, ERRLEN,"ERROR: %s must be greater than or equal to %f", HOME, self->fLower);
|
||||
SCWrite(pCon, pError, eError);
|
||||
if(!SCMatchRights(pCon,usMugger))
|
||||
return 1;
|
||||
else {
|
||||
if ( (self->fLower - newValue) > FLT_EPSILON) {
|
||||
snprintf(pError, ERRLEN,"ERROR: %s must be greater than or equal to %f", HOME, self->fLower);
|
||||
SCWrite(pCon, pError, eError);
|
||||
return 1;
|
||||
}
|
||||
if ( (newValue - self->fUpper) > FLT_EPSILON) {
|
||||
snprintf(pError, ERRLEN,"ERROR: %s must be less than or equal to %f", HOME, self->fUpper);
|
||||
SCWrite(pCon, pError, eError);
|
||||
return 1;
|
||||
}
|
||||
self->home = newValue;
|
||||
return 1;
|
||||
}
|
||||
if ( (newValue - self->fUpper) > FLT_EPSILON) {
|
||||
snprintf(pError, ERRLEN,"ERROR: %s must be less than or equal to %f", HOME, self->fUpper);
|
||||
SCWrite(pCon, pError, eError);
|
||||
return 1;
|
||||
}
|
||||
self->home = newValue;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Set upper limit, lower limit */
|
||||
/* Set hard limits, managers only */
|
||||
if(strcmp(name,HARDLOWERLIM) == 0) {
|
||||
self->fLower = newValue;
|
||||
return 1;
|
||||
if(!SCMatchRights(pCon,usMugger))
|
||||
return 1;
|
||||
else {
|
||||
self->fLower = newValue;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if(strcmp(name,HARDUPPERLIM) == 0) {
|
||||
self->fUpper = newValue;
|
||||
return 1;
|
||||
if(!SCMatchRights(pCon,usMugger))
|
||||
return 1;
|
||||
else {
|
||||
self->fUpper = newValue;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Set speed */
|
||||
@@ -1033,7 +1047,7 @@ static void KillDMC2280(/*@only@*/void *pData){
|
||||
strcpy(pNew->name, motor);
|
||||
pNew->home = 0.0;
|
||||
pNew->fLower = 0.0;//(float)atof(argv[2]);
|
||||
pNew->fUpper = 100.0;//(float)atof(argv[3]);
|
||||
pNew->fUpper = 0.0;//(float)atof(argv[3]);
|
||||
pNew->GetPosition = DMC2280GetPos;
|
||||
pNew->RunTo = DMC2280Run;
|
||||
pNew->GetStatus = DMC2280Status;
|
||||
|
||||
Reference in New Issue
Block a user