From a7626beeb781513adcf8cc23666507ce6d4140c1 Mon Sep 17 00:00:00 2001 From: Markus Zolliker Date: Fri, 7 Apr 2017 10:01:03 +0200 Subject: [PATCH] - arrobj.c: fixed bug when format sepcifier in array content - fsm.c: fixed bug - ipsdriv.c: fixed problem with old PS: no negative field, resolution --- arrobj.c | 2 +- fsm.c | 4 +--- ipsdriv.c | 16 ++++++++++++++-- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/arrobj.c b/arrobj.c index c3529a3..cf78f0c 100644 --- a/arrobj.c +++ b/arrobj.c @@ -138,7 +138,7 @@ static int ArrayItems(void *object, void *arg, int argc, char *argv[]) if (p > result) p--; *p = '\0'; - ParPrintf(object, eValue, result); + ParPrintf(object, eValue, "%s", result); free(result); } return 1; diff --git a/fsm.c b/fsm.c index 15828f2..dacd5c3 100644 --- a/fsm.c +++ b/fsm.c @@ -156,10 +156,8 @@ int FsmStop(Fsm * task, FsmFunc func) if (i == task->sp) { /* not found on stack */ if (func != task->func) return 0; /* is also not running function */\ - /* task->sp = 0; - task->func = task->stack[0].func; */ /* pretty unsure about this */ - + task->func = task->stack[0].func; /* pretty unsure about this */ } else { task->sp = i; /* unwind stack to level i */ } diff --git a/ipsdriv.c b/ipsdriv.c index 4e57349..2a7343c 100644 --- a/ipsdriv.c +++ b/ipsdriv.c @@ -194,7 +194,11 @@ void IpsParDef(void *object) ParPrintf(drv, eWarning, "limit is too high, set back to %.5g\n", drv->maxlimit); } - drv->d.lowerLimit = -drv->d.upperLimit; + if (drv->d.b.syntax) { /* IPS */ + drv->d.lowerLimit = -drv->d.upperLimit; + } else { /* PS */ + drv->d.lowerLimit = 0; + } } ParName("ramp"); @@ -609,8 +613,10 @@ static long IpsStart(long pc, void *object) case __LINE__: /**********************************/ if (0 == strncmp(eab->version, "IPS120", 6)) { eab->syntax = 1; + drv->d.lowerLimit = -drv->d.upperLimit; } else if (0 == strncmp(eab->version, "PS", 2)) { eab->syntax = 0; + drv->d.lowerLimit = 0; } else { snprintf(msg, sizeof msg, "unknown power supply version: %s", eab->version); @@ -699,6 +705,7 @@ static long IpsChangeField(long pc, void *object) float fld; float step; float ramp; + float eps; time_t delay; switch (pc) { @@ -905,7 +912,12 @@ static long IpsChangeField(long pc, void *object) fld = drv->current - step; } else { fld = drv->d.targetValue; - if (fabs(drv->current - drv->d.targetValue) < 1e-5) + if (eab->syntax) { + eps = 7.0e-5; /* IPS has 4 digits after decimal point */ + } else { + eps = 7.0e-4; /* PS has 3 digits after decimal point */ + } + if (fabs(drv->current - drv->d.targetValue) < eps) goto target_reached; } if (fabs(fld) >= drv->trainedTo) {