diff --git a/julprot.c b/julprot.c index 0ca8ac9..fa823d5 100644 --- a/julprot.c +++ b/julprot.c @@ -67,6 +67,7 @@ int JulchoHandler(Ascon * a) a->state = AsconTimeout; } } + return 0; } break; default: diff --git a/phytron.c b/phytron.c index db4433a..404c809 100644 --- a/phytron.c +++ b/phytron.c @@ -62,6 +62,7 @@ static int PhytronHandler(Ascon * a) a->state = AsconTimeout; } } + return 0; } break; default: diff --git a/pmacprot.c b/pmacprot.c index 5166106..7d645c1 100644 --- a/pmacprot.c +++ b/pmacprot.c @@ -16,6 +16,10 @@ * copyright: see file COPYRIGHT * * Mark Koennecke, December 2008 + * + * Introduced a delay on read in order to throttle requests + * + * Mark Koennecke, June 2011 */ #include #include @@ -79,8 +83,12 @@ typedef struct { char *ptr; int bytesToWrite; int expectACK; + double startTime; } PMACPrivate, *pPMACPrivate; - +/*---------------------------------------------------------------------------* +* wait period before read + ----------------------------------------------------------------------------*/ +#define READDELAY .05 /*---------------------------------------------------------------------------*/ static int PMACHandler(Ascon * a) { @@ -123,11 +131,19 @@ static int PMACHandler(Ascon * a) a->wrPos += ret; if (a->wrPos >= priv->bytesToWrite) { a->state = AsconWriteDone; + priv->startTime = DoubleTime(); } else { priv->ptr += ret; } } break; + case AsconReadStart: + DynStringClear(a->rdBuffer); + if(DoubleTime() > priv->startTime + READDELAY){ + a->start = DoubleTime(); + a->state = AsconReading; + } + break; case AsconReading: ret = AsconReadChar(a->fd, &chr); if (ret < 0) { @@ -166,6 +182,7 @@ static int PMACHandler(Ascon * a) a->state = AsconTimeout; } } + return 0; } break; default: diff --git a/polterwrite.c b/polterwrite.c index c2508c6..cb6d8be 100644 --- a/polterwrite.c +++ b/polterwrite.c @@ -6,6 +6,8 @@ copyright: see copyright.h Uwe Filges, November 2001 + + Various edits, added rotaion_speed_targtes, Mark Koennecke, 2011 ----------------------------------------------------------------------------*/ #include #include @@ -24,6 +26,7 @@ #include "polterwrite.h" #include "sicsvar.h" #include "nxscript.h" +#include "sicshipadaba.h" /* diaphragm1 - chopper @@ -128,9 +131,18 @@ static void writePolterdiGlobal(NXhandle hfil, NXdict hdict, /*-------------------------------------------------------------------*/ static void writeChopper(NXhandle hfil, NXdict hdict, SConnection * pCon) { + pHdb node = NULL; + float fVal; + SNXSPutVariable(pServ->pSics, pCon, hfil, hdict, "cname", "choppername"); SNXSPutDrivable(pServ->pSics, pCon, hfil, hdict, "chopperspeed", "crot"); SNXSPutDrivable(pServ->pSics, pCon, hfil, hdict, "chopperphase", "cphase"); + + node = FindHdbNode(NULL,"/sics/choco/chopper/nspee", NULL); + if(node != NULL){ + fVal = (float)node->value.v.doubleValue; + NXDputalias(hfil,hdict,"crottarget",&fVal); + } } /*-------------------------------------------------------------------*/ diff --git a/spss7.c b/spss7.c index 04f2c1d..3380caf 100644 --- a/spss7.c +++ b/spss7.c @@ -164,7 +164,7 @@ static char *S7WriteHandler(void *actionData, char *reply, int comerror) static void UpdateSPSDataBase(pS7Action self) { char *pPtr; - char name[15], unit[9], description[25], reference[11], error[50]; + char name[15], unit[9], description[25], reference[11], error[50], alarms[10]; unsigned char type, alarm; unsigned short val; int ival; @@ -220,6 +220,8 @@ static void UpdateSPSDataBase(pS7Action self) snprintf(error,50,"Alarm %d on par",alarm); SetHdbProperty(node,"geterror", error); } + snprintf(alarms,sizeof(alarms),"%d",alarm); + SetHdbProperty(node,"alarm", alarms); } } /*------------------------------------------------------------------ @@ -308,7 +310,7 @@ static hdbCallbackReturn S7WriteCallback(pHdb currentNode, static void InitializeSPSDataBase(pS7Action self, pHdb parent) { char *pPtr; - char name[15], unit[9], description[25], reference[11], num[11], error[50]; + char name[15], unit[9], description[25], reference[11], num[11], error[50], alarms[10]; unsigned char type, alarm; short val; int ival; @@ -364,6 +366,8 @@ static void InitializeSPSDataBase(pS7Action self, pHdb parent) snprintf(error,10,"Alarm %d on par",alarm); SetHdbProperty(node,"geterror", error); } + snprintf(alarms,sizeof(alarms),"%d",alarm); + SetHdbProperty(node,"alarm", alarms); SetHdbProperty(node,"unit", unit); SetHdbProperty(node,"description", description); SetHdbProperty(node,"reference", reference);