Remove superfluous trailing white space from C files
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
/*--------------------------------------------------------------------------
|
||||
|
||||
L H 4 5 U T I L
|
||||
|
||||
|
||||
A few utility functions for dealing with a LH45 temperature controller
|
||||
within the SINQ setup: host -- TCP/IP -- MAC --- RS-232.
|
||||
|
||||
|
||||
Mark Koennecke, Juli 1997
|
||||
Mark Lesha, January 2006 (based on ITC4 code)
|
||||
|
||||
@@ -64,7 +64,7 @@ char *ReplyStart(char *pReply)
|
||||
int iRet;
|
||||
char pCommand[20];
|
||||
char pReply[132],*pReplyStart;
|
||||
|
||||
|
||||
/* Check the status. It should read '03 REMOTE START' or possibly '03 REMOTE START,DEGASING'. */
|
||||
/* If there is any LH45 overload or other fault condition it will be detected here. */
|
||||
// printf("Checking LH45 status...");fflush(stdout);
|
||||
@@ -75,17 +75,17 @@ char *ReplyStart(char *pReply)
|
||||
pReplyStart=ReplyStart(pReply);
|
||||
usleep(500000);
|
||||
if(iRet <= 0)
|
||||
{
|
||||
{
|
||||
//transactRS232(self->co/home/mrt/workspacentroller,"\nDEBUG: RS232 transaction bad.\n",28,pReply,79);
|
||||
return iRet;
|
||||
}
|
||||
}
|
||||
printf("Status is: '%s'\n",pReplyStart);fflush(stdout);
|
||||
|
||||
|
||||
int i;
|
||||
for(i=0;i<strlen(pReply);i++)
|
||||
printf("0x%02x ",((unsigned char *)pReply)[i]);
|
||||
printf("\n");
|
||||
|
||||
|
||||
if (strncmp(pReplyStart,"03 REMOTE START",15)!=0)
|
||||
{
|
||||
//transactRS232(self->controller,"\nDEBUG: RS232 response bad\n",27,pReply,79);
|
||||
@@ -96,17 +96,17 @@ char *ReplyStart(char *pReply)
|
||||
//transactRS232(self->controller,"\nDEBUG: Status reply is good!\n",30,pReply,79);
|
||||
return 1; // 1 = no fault
|
||||
}
|
||||
|
||||
|
||||
int LH45_Setup(pLH45 self, int iControl) /* Operations common to both Open and Config functions */
|
||||
{
|
||||
int iRet;
|
||||
char pCommand[20];
|
||||
//char pReply[132];
|
||||
|
||||
|
||||
/* MJL enable RS232 debugging mode. */
|
||||
//setRS232Debug(self->controller,1);
|
||||
//printf("***RS232 debug mode enabled for LH45***\n");fflush(stdout);
|
||||
|
||||
|
||||
/* switch to remote operation - although don't want it to initialise */
|
||||
/* NOTE: The Julabo does not provide any response for 'out' commands,
|
||||
so we just use writeRS232 not transactRS232 for these */
|
||||
@@ -116,19 +116,19 @@ char *ReplyStart(char *pReply)
|
||||
usleep(500000);
|
||||
printf("OUT_MODE_05 1 is completed \n");fflush(stdout);
|
||||
if(iRet != 1)
|
||||
{
|
||||
{
|
||||
return iRet;
|
||||
}
|
||||
}
|
||||
/* if(pReply[0] == '-') // Probably an error response
|
||||
{
|
||||
strcpy(self->pAns,pReply);
|
||||
return LH45__BADCOM;
|
||||
} */
|
||||
|
||||
|
||||
/* Check the LH45 operating status */
|
||||
if ((iRet=LH45_Check_Status(self))!=1)
|
||||
return iRet;
|
||||
|
||||
|
||||
/* Set heater sensor */
|
||||
/* For the LH45 there is a choice of internal or external sensor control,
|
||||
set internal when iControl==1 and external when iControl==2 */
|
||||
@@ -139,32 +139,32 @@ char *ReplyStart(char *pReply)
|
||||
if(iRet != 1)
|
||||
{
|
||||
return LH45__BADCOM;
|
||||
}
|
||||
}
|
||||
/* else if(pReply[0] == '-') // Probably an error response
|
||||
{
|
||||
strcpy(self->pAns,pReply);
|
||||
return LH45__BADCOM;
|
||||
} */
|
||||
self->iControl=iControl; // Store control sensor setting since it was assigned to the LH45 successfully
|
||||
|
||||
|
||||
/* reset timeout - currently not being used */
|
||||
/* iRet = SerialConfig(&self->pData, 10);
|
||||
if(iRet != 1)
|
||||
{
|
||||
return iRet;
|
||||
} */
|
||||
|
||||
|
||||
/* Check the LH45 operating status one last time */
|
||||
if ((iRet=LH45_Check_Status(self))!=1)
|
||||
return iRet;
|
||||
|
||||
|
||||
return 1; /* Success */
|
||||
}
|
||||
|
||||
int LH45_Open(pLH45 *pData, char *pRS232, int iSensor, int iCTRL, int iMode)
|
||||
{
|
||||
pLH45 self = NULL;
|
||||
|
||||
|
||||
self = (pLH45)malloc(sizeof(LH45));
|
||||
if(self == NULL)
|
||||
{
|
||||
@@ -174,14 +174,14 @@ char *ReplyStart(char *pReply)
|
||||
self->iControl = iCTRL;
|
||||
self->iRead = iSensor;
|
||||
self->iReadOnly = iMode;
|
||||
|
||||
|
||||
/* The LH45 doesn't require divisors or multipliers
|
||||
and they are always forced to 1.0 */
|
||||
self->fDiv = 1.0;
|
||||
self->fMult = 1.0;
|
||||
|
||||
|
||||
self->controller = NULL;
|
||||
|
||||
|
||||
self->controller = (prs232)FindCommandData(pServ->pSics,pRS232,
|
||||
"RS232 Controller");
|
||||
if(!self->controller){
|
||||
@@ -192,7 +192,7 @@ char *ReplyStart(char *pReply)
|
||||
if(!self->iReadOnly)
|
||||
return LH45_Setup(self, self->iControl);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
void LH45_Close(pLH45 *pData)
|
||||
{
|
||||
@@ -204,7 +204,7 @@ char *ReplyStart(char *pReply)
|
||||
self = *pData;
|
||||
if (!self)
|
||||
return; // Just in case
|
||||
|
||||
|
||||
/* switch off remote operation */
|
||||
/* Not sure if this is really necessary but do it just in case */
|
||||
sprintf(pCommand,"OUT_MODE_05 0");
|
||||
@@ -213,19 +213,19 @@ char *ReplyStart(char *pReply)
|
||||
/* Don't bother checking the status but record any error reply */
|
||||
/* if(pReply[0] == '-') // Probably an error response
|
||||
strcpy(self->pAns,pReply); */
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
int LH45_Config(pLH45 *pData, int iTmo, int iRead, int iControl,
|
||||
int LH45_Config(pLH45 *pData, int iTmo, int iRead, int iControl,
|
||||
float fDiv,float fMult)
|
||||
{
|
||||
pLH45 self;
|
||||
|
||||
|
||||
self = *pData;
|
||||
|
||||
|
||||
return LH45_Setup(self, iControl);
|
||||
}
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
int LH45_Send(pLH45 *pData, char *pCommand, char *pReply, int iLen)
|
||||
{
|
||||
@@ -240,7 +240,7 @@ char *ReplyStart(char *pReply)
|
||||
{
|
||||
strcat(pCommand,"\r");
|
||||
} */
|
||||
|
||||
|
||||
/* Send command direct to the LH45 */
|
||||
/* Because the Julabo LH45 only provides a response for the 'version', 'status'
|
||||
and 'in' commands and not for the 'out' commands, just perform a write
|
||||
@@ -262,8 +262,8 @@ char *ReplyStart(char *pReply)
|
||||
} while(*pReplyStart++);
|
||||
}
|
||||
if(iRet <= 0)
|
||||
return iRet;
|
||||
|
||||
return iRet;
|
||||
|
||||
/* Check the LH45 operating status after issuing the command, and return */
|
||||
iRet=LH45_Check_Status(self);
|
||||
return iRet;
|
||||
@@ -294,17 +294,17 @@ char *ReplyStart(char *pReply)
|
||||
default:
|
||||
return LH45__BADPAR; // But shouldn't happen
|
||||
}
|
||||
|
||||
|
||||
iRet = transactRS232(self->controller, pCommand,strlen(pCommand),
|
||||
pReply,79);
|
||||
pReplyStart=ReplyStart(pReply);
|
||||
usleep(500000);
|
||||
|
||||
|
||||
if(iRet <= 0)
|
||||
{
|
||||
return iRet;
|
||||
}
|
||||
|
||||
|
||||
//sprintf(self->pAns,"The read value is '%s'\n and the command is: '%s' \n",pReply,pCommand);
|
||||
//return LH45__FAULT;
|
||||
if(*pReplyStart == '-' && strlen(pReplyStart)>7) // Not a number (-XXX.X\r), probably an error response
|
||||
@@ -312,11 +312,11 @@ char *ReplyStart(char *pReply)
|
||||
strcpy(self->pAns,pReplyStart);
|
||||
return LH45__BADCOM;
|
||||
}
|
||||
|
||||
|
||||
iRet = sscanf(pReplyStart,"%f",&fRead);
|
||||
if (iRet == 1)
|
||||
*fVal = fRead;
|
||||
|
||||
|
||||
/* Check the LH45 operating status after the read, and return */
|
||||
iRet=LH45_Check_Status(self);
|
||||
return iRet;
|
||||
@@ -336,27 +336,27 @@ char *ReplyStart(char *pReply)
|
||||
{
|
||||
return LH45__READONLY;
|
||||
}
|
||||
|
||||
|
||||
sprintf(pCommand,"OUT_SP_00 %1.1f",fVal);
|
||||
sprintf(pCommandRead,"IN_SP_00"); // To read back and check the set value
|
||||
|
||||
|
||||
/* try three times: send, read, test, if OK return, else resend. */
|
||||
for(i = 0; i < 3; i++)
|
||||
{
|
||||
/* send command, since it's an 'out' we don't get any response, so use writeRS232 */
|
||||
{
|
||||
/* send command, since it's an 'out' we don't get any response, so use writeRS232 */
|
||||
iRet = writeRS232(self->controller,pCommand,strlen(pCommand));
|
||||
usleep(500000);
|
||||
//writeRS232(self->controller,pReply,strlen(pReply)); // MJL DEBUG
|
||||
if(iRet != 1)
|
||||
{
|
||||
return iRet;
|
||||
}
|
||||
}
|
||||
/* if(pReply[0] == '-') // Probably an error response
|
||||
{
|
||||
strcpy(self->pAns,pReply);
|
||||
return LH45__BADCOM;
|
||||
} */
|
||||
|
||||
|
||||
/* read the set value again using the 'in' command */
|
||||
iRet = transactRS232(self->controller,pCommandRead,strlen(pCommandRead),pReply,131);
|
||||
pReplyStart=ReplyStart(pReply);
|
||||
@@ -365,7 +365,7 @@ char *ReplyStart(char *pReply)
|
||||
if(iRet <= 0)
|
||||
{
|
||||
return iRet;
|
||||
}
|
||||
}
|
||||
if(*pReplyStart == '-'&&strlen(pReplyStart)>7) // Not a number (-XXX.X\r), probably an error response
|
||||
{
|
||||
strcpy(self->pAns,pReplyStart);
|
||||
@@ -405,7 +405,7 @@ char *ReplyStart(char *pReply)
|
||||
pLH45 self;
|
||||
|
||||
self = *pData;
|
||||
|
||||
|
||||
switch(iCode)
|
||||
{
|
||||
case LH45__BADCOM:
|
||||
@@ -431,6 +431,6 @@ char *ReplyStart(char *pReply)
|
||||
break;
|
||||
default:
|
||||
getRS232Error(iCode, pError,iLen);
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user