Add posit2soft to get soft position from position
This commit is contained in:
@ -621,6 +621,13 @@ static double posit2unit(pDMC2280Driv self, double target) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static double posit2soft(pDMC2280Driv self, double target) {
|
||||||
|
double fSoft, fHard;
|
||||||
|
fHard = posit2unit(self, target);
|
||||||
|
getSoftFromHard(self, NULL, fHard, &fSoft);
|
||||||
|
return fSoft;
|
||||||
|
}
|
||||||
|
|
||||||
static long long posit2count(pDMC2280Driv self, double target) {
|
static long long posit2count(pDMC2280Driv self, double target) {
|
||||||
return unit2count(self, posit2unit(self, target));
|
return unit2count(self, posit2unit(self, target));
|
||||||
}
|
}
|
||||||
@ -6092,6 +6099,20 @@ int DMC2280Action(SConnection *pCon, SicsInterp *pSics, void *pData,
|
|||||||
SCWrite(pCon, line, eValue);
|
SCWrite(pCon, line, eValue);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
else if(strcasecmp("posit2soft", argv[1]) == 0) {
|
||||||
|
char line[132];
|
||||||
|
if (argc > 2) {
|
||||||
|
double target;
|
||||||
|
target = strtod(argv[2], NULL);
|
||||||
|
snprintf(line, 132, "%s.posit2soft = %f",
|
||||||
|
self->name,
|
||||||
|
posit2soft(self, target));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
strcpy(line, "missing value");
|
||||||
|
SCWrite(pCon, line, eValue);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
else if(strcasecmp("posit2unit", argv[1]) == 0) {
|
else if(strcasecmp("posit2unit", argv[1]) == 0) {
|
||||||
char line[132];
|
char line[132];
|
||||||
if (argc > 2) {
|
if (argc > 2) {
|
||||||
|
Reference in New Issue
Block a user