This commit is contained in:
zolliker
2005-08-24 10:54:10 +00:00
parent 5170be9346
commit 041d071f17
2 changed files with 21 additions and 5 deletions

View File

@ -138,9 +138,13 @@ void IpsStatus(IpsDriv *me) {
/*----------------------------------------------------------------------------*/
static void IpsSetField(IpsDriv *me, float val) {
char buf[128];
SConnection *pCon;
if (me->eve.value != val && me->eve.evc != NULL) {
snprintf(buf, sizeof(buf), "%s = %g", me->eve.evc->pName, val);
InvokeCallBack(me->eve.evc->pCall, VALUECHANGE, buf);
pCon = SCLoad(&me->eve.evc->conn);
if (pCon) SCparChange(pCon);
}
if (me->perswitch) {
me->current = val;
@ -258,7 +262,7 @@ static int IpsChangeField(long pc, IpsDriv *me) {
EveWrite(eve, "X");
FSM_NEXT
IpsStatus(me);
if (time(NULL) < me->tim + 3) goto stab2; /* stabilize */
if (time(NULL) < me->tim + 10) goto stab2; /* stabilize */
switch_on:
if (me->perswitch) goto wait_open;
@ -332,6 +336,10 @@ static int IpsChangeField(long pc, IpsDriv *me) {
me->tim = time(NULL);
stab3:
FSM_WAIT(1)
EveWrite(eve, "R18"); /* read persistant field in Tesla */
FSM_NEXT
IpsSetField(me, OiGetFlt(eve, 3, NULL));
me->lastfield = me->persfield;
EveWrite(eve, "X");
FSM_NEXT
IpsStatus(me); /* just check for errors */
@ -349,6 +357,10 @@ static int IpsChangeField(long pc, IpsDriv *me) {
EvePrintf(eve, -1, "IPS: wait 30 sec to close switch");
wait_closed:
EveWrite(eve, "R18"); /* read persistant field in Tesla */
FSM_NEXT
IpsSetField(me, OiGetFlt(eve, 3, NULL));
me->lastfield = me->persfield;
FSM_WAIT(1)
EveWrite(eve, "X");
FSM_NEXT