Commit 5347d3d5 authored by koennecke's avatar koennecke
Browse files

Merge branch 'sea' of ssh://gitlab.psi.ch/sinqdev/sicspsi into rhel7

parents f41c80aa be60bbed
......@@ -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;
......
......@@ -466,7 +466,7 @@ int EaseUpdate(int flag)
if (ParActionIs(PAR_SET) > 0) {
assert(flag >= 0);
assert(flag <= eab->maxflag);
eab->updateFlags[flag / EASE_FLAGBITS] |= 1 << (flag % EASE_FLAGBITS);
eab->updateFlags[flag / EASE_FLAGBITS] |= (unsigned long)1 << (flag % EASE_FLAGBITS);
if (eab->task)
FsmSpeed(eab->task);
return 1;
......@@ -487,7 +487,7 @@ int EaseNextUpdate(void *object)
p = 1;
flag = 0;
/* find first */
while (flag < 32) {
while (flag < EASE_FLAGBITS) {
if (mask & p) {
eab->updateFlags[i] &= ~p;
return flag + i * EASE_FLAGBITS;
......@@ -508,7 +508,7 @@ int EaseGetUpdate(void *object, int flag)
assert(flag >= 0);
assert(flag <= eab->maxflag);
i = flag / EASE_FLAGBITS;
if ((1 << (flag % EASE_FLAGBITS)) & eab->updateFlags[i]) {
if (((unsigned long)1 << (flag % EASE_FLAGBITS)) & eab->updateFlags[i]) {
return 1;
}
return 0;
......@@ -523,10 +523,10 @@ void EaseSetUpdate(void *object, int flag, int state)
assert(flag <= eab->maxflag);
if (state) {
eab->updateFlags[flag / EASE_FLAGBITS] |= 1 << (flag % EASE_FLAGBITS);
eab->updateFlags[flag / EASE_FLAGBITS] |= (unsigned long)1 << (flag % EASE_FLAGBITS);
} else {
eab->updateFlags[flag / EASE_FLAGBITS] &=
~(1 << (flag % EASE_FLAGBITS));
~((unsigned long)1 << (flag % EASE_FLAGBITS));
}
}
......
......@@ -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 */
}
......
......@@ -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) {
......
......@@ -1549,6 +1549,7 @@ void *ParMake(SConnection * con, char *name, ParClass * class,
o->desc = CreateDescriptor(class->name);
assert(o->desc);
o->desc->SaveStatus = ParSaveAll;
SetDescriptorKey(o->desc, "pardef", "1");
o->creationCmd = creationCmd;
o->pCall = NULL;
o->logTime = 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment