- 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
This commit is contained in:
2017-04-07 10:01:03 +02:00
parent 3abcb4fb1c
commit a7626beeb7
3 changed files with 16 additions and 6 deletions

View File

@ -138,7 +138,7 @@ static int ArrayItems(void *object, void *arg, int argc, char *argv[])
if (p > result) if (p > result)
p--; p--;
*p = '\0'; *p = '\0';
ParPrintf(object, eValue, result); ParPrintf(object, eValue, "%s", result);
free(result); free(result);
} }
return 1; return 1;

4
fsm.c
View File

@ -156,10 +156,8 @@ int FsmStop(Fsm * task, FsmFunc func)
if (i == task->sp) { /* not found on stack */ if (i == task->sp) { /* not found on stack */
if (func != task->func) if (func != task->func)
return 0; /* is also not running function */\ return 0; /* is also not running function */\
/*
task->sp = 0; task->sp = 0;
task->func = task->stack[0].func; */ /* pretty unsure about this */ task->func = task->stack[0].func; /* pretty unsure about this */
} else { } else {
task->sp = i; /* unwind stack to level i */ task->sp = i; /* unwind stack to level i */
} }

View File

@ -194,7 +194,11 @@ void IpsParDef(void *object)
ParPrintf(drv, eWarning, "limit is too high, set back to %.5g\n", ParPrintf(drv, eWarning, "limit is too high, set back to %.5g\n",
drv->maxlimit); 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"); ParName("ramp");
@ -609,8 +613,10 @@ static long IpsStart(long pc, void *object)
case __LINE__: /**********************************/ case __LINE__: /**********************************/
if (0 == strncmp(eab->version, "IPS120", 6)) { if (0 == strncmp(eab->version, "IPS120", 6)) {
eab->syntax = 1; eab->syntax = 1;
drv->d.lowerLimit = -drv->d.upperLimit;
} else if (0 == strncmp(eab->version, "PS", 2)) { } else if (0 == strncmp(eab->version, "PS", 2)) {
eab->syntax = 0; eab->syntax = 0;
drv->d.lowerLimit = 0;
} else { } else {
snprintf(msg, sizeof msg, snprintf(msg, sizeof msg,
"unknown power supply version: %s", eab->version); "unknown power supply version: %s", eab->version);
@ -699,6 +705,7 @@ static long IpsChangeField(long pc, void *object)
float fld; float fld;
float step; float step;
float ramp; float ramp;
float eps;
time_t delay; time_t delay;
switch (pc) { switch (pc) {
@ -905,7 +912,12 @@ static long IpsChangeField(long pc, void *object)
fld = drv->current - step; fld = drv->current - step;
} else { } else {
fld = drv->d.targetValue; 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; goto target_reached;
} }
if (fabs(fld) >= drv->trainedTo) { if (fabs(fld) >= drv->trainedTo) {