diff --git a/site_ansto/nhq200driv.c b/site_ansto/nhq200driv.c index 8a7ca37d..dadace7a 100644 --- a/site_ansto/nhq200driv.c +++ b/site_ansto/nhq200driv.c @@ -51,12 +51,11 @@ typedef struct __EVDriver *pEVDriver; -#include +#include /* Do we need these ? #include #include */ -#include #include #include #include "hardsup/nhq200util.h" @@ -93,7 +92,7 @@ static int GetNHQ200Pos(pEVDriver self, float *fPos) pMe = (pNHQ200Driv)self->pPrivate; assert(pMe); - iRet = NHQ200_Read(&pMe->pData,fPos); + iRet = NHQ200_Read(&pMe->pData,fPos); if(iRet <= 0 ) { pMe->iLastError = iRet; @@ -106,7 +105,7 @@ static int GetNHQ200Pos(pEVDriver self, float *fPos) return 0; } return 1; -} +} /*----------------------------------------------------------------------------*/ static int NHQ200Run(pEVDriver self, float fVal) { @@ -137,11 +136,11 @@ static int NHQ200Error(pEVDriver self, int *iCode, char *error, int iErrLen) *iCode = pMe->iLastError; if(pMe->iLastError == SHITTYVALUE) { - strncpy(error,"Invalid temperature returned form NHQ200, check sensor",iErrLen); + strncpy(error,"Invalid voltage returned from NHQ200, check unit",iErrLen); } else { - NHQ200_ErrorTxt(&pMe->pData,pMe->iLastError,error,iErrLen); + NHQ200_ErrorTxt(&pMe->pData,pMe->iLastError,error,iErrLen); } return 1; } @@ -163,7 +162,7 @@ static int NHQ200Send(pEVDriver self, char *pCommand, char *pReply, int iLen) } return 1; -} +} /*--------------------------------------------------------------------------*/ static int NHQ200Init(pEVDriver self) { @@ -186,15 +185,14 @@ static int NHQ200Init(pEVDriver self) { pMe->iLastError = iRet; return 0; - } + } } return 1; -} +} /*--------------------------------------------------------------------------*/ static int NHQ200Close(pEVDriver self) { pNHQ200Driv pMe = NULL; - int iRet; assert(self); pMe = (pNHQ200Driv )self->pPrivate; @@ -202,7 +200,7 @@ static int NHQ200Close(pEVDriver self) NHQ200_Close(&pMe->pData); return 1; -} +} /*---------------------------------------------------------------------------*/ static int NHQ200Fix(pEVDriver self, int iError) { @@ -234,11 +232,11 @@ static int NHQ200Fix(pEVDriver self, int iError) if(iRet) { return DEVREDO; - } + } else { return DEVFAULT; - } + } break; /* handable protocoll errors */ case EL734__BAD_TMO: @@ -247,10 +245,10 @@ static int NHQ200Fix(pEVDriver self, int iError) case -501: /* Bad_COM */ return DEVREDO; case -504: /* Badly formatted */ - return DEVREDO; + return DEVREDO; default: return DEVFAULT; - break; + break; } return DEVFAULT; } @@ -275,7 +273,7 @@ void KillNHQ200(void *pData) free(pMe->pHost); } free(pMe); -} +} /*------------------------------------------------------------------------*/ pEVDriver CreateNHQ200Driver(int argc, char *argv[]) { @@ -324,8 +322,8 @@ pEVDriver CreateNHQ200Driver(int argc, char *argv[]) pNew->Init = NHQ200Init; pNew->Close = NHQ200Close; - return pNew; -} + return pNew; +} /*--------------------------------------------------------------------------*/ int ConfigNHQ200(pEVDriver self) { @@ -336,7 +334,7 @@ int ConfigNHQ200(pEVDriver self) pMe = (pNHQ200Driv )self->pPrivate; assert(pMe); - iRet = NHQ200_Config(&pMe->pData, pMe->iTmo, pMe->iRead, + iRet = NHQ200_Config(&pMe->pData, pMe->iTmo, pMe->iRead, pMe->iControl,pMe->fDiv,pMe->fMult); if(iRet < 0) { @@ -349,7 +347,6 @@ int ConfigNHQ200(pEVDriver self) int SetSensorNHQ200(pEVDriver self, int iSensor) { pNHQ200Driv pMe = NULL; - int iRet; assert(self); pMe = (pNHQ200Driv )self->pPrivate; @@ -359,7 +356,7 @@ int SetSensorNHQ200(pEVDriver self, int iSensor) if( (iSensor < 1) || (iSensor > 2) ) { return 0; - } + } pMe->iRead = iSensor; pMe->pData->iRead = iSensor; return 1; @@ -368,7 +365,6 @@ int SetSensorNHQ200(pEVDriver self, int iSensor) int SetControlNHQ200(pEVDriver self, int iSensor) { pNHQ200Driv pMe = NULL; - int iRet; assert(self); pMe = (pNHQ200Driv )self->pPrivate; @@ -378,7 +374,7 @@ int SetControlNHQ200(pEVDriver self, int iSensor) if( (iSensor < 1) || (iSensor > 2) ) { return 0; - } + } pMe->iControl = iSensor; pMe->pData->iControl = iSensor; return 1; @@ -387,7 +383,6 @@ int SetControlNHQ200(pEVDriver self, int iSensor) int SetTMONHQ200(pEVDriver self, int iSensor) { pNHQ200Driv pMe = NULL; - int iRet; assert(self); pMe = (pNHQ200Driv )self->pPrivate; @@ -396,7 +391,7 @@ int SetTMONHQ200(pEVDriver self, int iSensor) if(iSensor < 10) { return 0; - } + } pMe->iTmo = iSensor; return 1; } @@ -404,7 +399,6 @@ int SetTMONHQ200(pEVDriver self, int iSensor) int GetControlNHQ200(pEVDriver self) { pNHQ200Driv pMe = NULL; - int iRet; assert(self); pMe = (pNHQ200Driv )self->pPrivate; @@ -416,7 +410,6 @@ int GetControlNHQ200(pEVDriver self) int GetSensorNHQ200(pEVDriver self) { pNHQ200Driv pMe = NULL; - int iRet; assert(self); pMe = (pNHQ200Driv )self->pPrivate; @@ -428,7 +421,6 @@ int GetSensorNHQ200(pEVDriver self) int GetTMONHQ200(pEVDriver self) { pNHQ200Driv pMe = NULL; - int iRet; assert(self); pMe = (pNHQ200Driv )self->pPrivate; @@ -440,7 +432,6 @@ int GetTMONHQ200(pEVDriver self) float GetDivisorNHQ200(pEVDriver self) { pNHQ200Driv pMe = NULL; - int iRet; assert(self); pMe = (pNHQ200Driv )self->pPrivate; @@ -452,7 +443,6 @@ float GetDivisorNHQ200(pEVDriver self) int SetDivisorNHQ200(pEVDriver self, float fDiv) { pNHQ200Driv pMe = NULL; - int iRet; assert(self); pMe = (pNHQ200Driv )self->pPrivate; @@ -466,7 +456,6 @@ int SetDivisorNHQ200(pEVDriver self, float fDiv) float GetMultNHQ200(pEVDriver self) { pNHQ200Driv pMe = NULL; - int iRet; assert(self); pMe = (pNHQ200Driv )self->pPrivate; @@ -478,7 +467,6 @@ float GetMultNHQ200(pEVDriver self) int SetMultNHQ200(pEVDriver self, float fDiv) { pNHQ200Driv pMe = NULL; - int iRet; assert(self); pMe = (pNHQ200Driv )self->pPrivate;