- 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)
p--;
*p = '\0';
ParPrintf(object, eValue, result);
ParPrintf(object, eValue, "%s", result);
free(result);
}
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 (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 */
}

View File

@ -194,7 +194,11 @@ void IpsParDef(void *object)
ParPrintf(drv, eWarning, "limit is too high, set back to %.5g\n",
drv->maxlimit);
}
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) {