diff --git a/site_ansto/hardsup/nhq200util.c b/site_ansto/hardsup/nhq200util.c index 1a72a028..5ace3227 100644 --- a/site_ansto/hardsup/nhq200util.c +++ b/site_ansto/hardsup/nhq200util.c @@ -382,6 +382,7 @@ int NHQ200_Check_Status(pNHQ200 self) /* Can be called to check for correct operation of the NHQ200 */ { int iRet, iRetry, busy, notbusy; + int iRspLen; char pCommand[20]; char pReply[132]; /* Check the busy status. @@ -395,8 +396,9 @@ int NHQ200_Check_Status(pNHQ200 self) printf("Checking status..."); do { + iRspLen = 79; sprintf(pCommand,"S%d", self->iControl); - iRet=AsyncUnitTransact(self->unit, pCommand, strlen(pCommand), pReply, 79); + iRet=AsyncUnitTransact(self->unit, pCommand, strlen(pCommand), pReply, &iRspLen); if (iRet <= 0) { printf("Comms error!\n"); @@ -497,6 +499,7 @@ int NHQ200_Config(pNHQ200 *pData, int iTmo, int iRead, int iControl, int NHQ200_Send(pNHQ200 *pData, char *pCommand, char *pReply, int iLen) { int iRet; + int iRspLen; int commandlen; pNHQ200 self; @@ -505,7 +508,8 @@ int NHQ200_Send(pNHQ200 *pData, char *pCommand, char *pReply, int iLen) /* Send command direct to the NHQ200 */ commandlen=strlen(pCommand); - iRet=AsyncUnitTransact(self->unit, pCommand, commandlen, pReply, iLen); + iRspLen = iLen; + iRet=AsyncUnitTransact(self->unit, pCommand, commandlen, pReply, &iRspLen); return iRet; } @@ -550,6 +554,7 @@ int NHQ200_Set(pNHQ200 *pData, float fVal) { char pCommand[20], pCommandRead[20], pReply[132], pCommandGo[20]; int iRet; + int iRspLen; const float fPrecision = 0.1; float fDelta, fRead; pNHQ200 self; @@ -567,11 +572,13 @@ int NHQ200_Set(pNHQ200 *pData, float fVal) sprintf(pCommandRead,"D%d", self->iControl); /* send Dn=nnn command, we get a blank line response */ - iRet = AsyncUnitTransact(self->unit,pCommand,strlen(pCommand),pReply,131); + iRspLen = 131; + iRet = AsyncUnitTransact(self->unit,pCommand,strlen(pCommand),pReply, &iRspLen); if (iRet <= 0) return iRet; /* read the set value again using the Dn command */ - iRet = AsyncUnitTransact(self->unit,pCommandRead,strlen(pCommandRead),pReply,131); + iRspLen = 131; + iRet = AsyncUnitTransact(self->unit,pCommandRead,strlen(pCommandRead),pReply, &iRspLen); if (iRet <= 0) return iRet; printf("D%d: Response %d chars: '%s'\n",self->iControl, iRet, pReply); @@ -588,7 +595,8 @@ int NHQ200_Set(pNHQ200 *pData, float fVal) if(fDelta < fPrecision) { sprintf(pCommandGo, "G%d", self->iControl); - iRet = AsyncUnitTransact(self->unit,pCommandGo,strlen(pCommandGo),pReply,131); + iRspLen = 131; + iRet = AsyncUnitTransact(self->unit,pCommandGo,strlen(pCommandGo),pReply, &iRspLen); if (iRet <= 0) return iRet; printf("G%d: Response %d chars: '%s'\n",self->iControl, iRet, pReply);