From c7a2d05832296f3dbc83ada9a3399ad5d7dae2ef Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Fri, 30 May 2014 12:22:31 +1000 Subject: [PATCH] Add posit2soft to get soft position from position --- site_ansto/motor_dmc2280.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/site_ansto/motor_dmc2280.c b/site_ansto/motor_dmc2280.c index ae8e9054..81b4f2ec 100644 --- a/site_ansto/motor_dmc2280.c +++ b/site_ansto/motor_dmc2280.c @@ -621,6 +621,13 @@ static double posit2unit(pDMC2280Driv self, double target) { 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) { return unit2count(self, posit2unit(self, target)); } @@ -6092,6 +6099,20 @@ int DMC2280Action(SConnection *pCon, SicsInterp *pSics, void *pData, SCWrite(pCon, line, eValue); 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) { char line[132]; if (argc > 2) {