Added "setpos" method to motors
r1099 | ffr | 2006-09-01 14:46:44 +1000 (Fri, 01 Sep 2006) | 2 lines
This commit is contained in:
committed by
Douglas Clowes
parent
7bdd25b248
commit
1fb33a1d2e
@@ -24,6 +24,7 @@
|
||||
#include <sics.h>
|
||||
#include <rs232controller.h>
|
||||
#include <modriv.h>
|
||||
#include <motor.h>
|
||||
#include <dynstring.h>
|
||||
#include "anstoutil.h"
|
||||
|
||||
@@ -80,6 +81,7 @@ typedef struct __MoDriv {
|
||||
|
||||
/* DMC-2280 specific fields */
|
||||
prs232 controller;
|
||||
pMotor pMot; /**< Points to logical motor object */
|
||||
int errorCode;
|
||||
char *errorMsg; /**< Points to memory for error messages */
|
||||
char units[256]; /**< physical units for axis */
|
||||
@@ -129,6 +131,7 @@ typedef struct __MoDriv {
|
||||
#define BUFFLEN 512
|
||||
#define _SAVEPOWER 0
|
||||
|
||||
#define SETPOS "setpos"
|
||||
#define HOME "home"
|
||||
#define HARDLOWERLIM "hardlowerlim"
|
||||
#define HARDUPPERLIM "hardupperlim"
|
||||
@@ -785,6 +788,7 @@ static int DMC2280SetPar(void *pData, SConnection *pCon,
|
||||
pDMC2280Driv self = NULL;
|
||||
char pError[ERRLEN];
|
||||
char cmd[CMDLEN];
|
||||
float currPos, oldZero, newZero;
|
||||
|
||||
self = (pDMC2280Driv)pData;
|
||||
|
||||
@@ -809,6 +813,15 @@ static int DMC2280SetPar(void *pData, SConnection *pCon,
|
||||
}
|
||||
}
|
||||
|
||||
if(strcmp(name,SETPOS) == 0) {
|
||||
if (self->pMot == NULL)
|
||||
self->pMot = FindMotor(pServ->pSics, self->name);
|
||||
MotorGetPar(self->pMot,"softzero",&oldZero);
|
||||
newZero = (self->pMot->fPosition - newValue) + oldZero;
|
||||
MotorSetPar(self->pMot,pCon,"softzero",newZero);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Set hard limits, managers only */
|
||||
if(strcmp(name,HARDLOWERLIM) == 0) {
|
||||
if(!SCMatchRights(pCon,usMugger))
|
||||
@@ -1044,6 +1057,7 @@ static void KillDMC2280(/*@only@*/void *pData){
|
||||
KillDMC2280(pNew);
|
||||
return NULL;
|
||||
}
|
||||
pNew->pMot = NULL;
|
||||
strcpy(pNew->name, motor);
|
||||
pNew->home = 0.0;
|
||||
pNew->fLower = 0.0;//(float)atof(argv[2]);
|
||||
|
||||
Reference in New Issue
Block a user