fix missing return from ITC4_Config, change SerialError to getRS232Error, adjust Formatting

r2415 | dcl | 2008-04-14 08:37:57 +1000 (Mon, 14 Apr 2008) | 2 lines
This commit is contained in:
Douglas Clowes
2008-04-14 08:37:57 +10:00
parent 895e52bfe9
commit 519bf308fa

View File

@@ -191,91 +191,91 @@
char pCommand[10];
pITC4 self;
self = *pData;
self = *pData;
/* 3 input channels see p52 */
/* BUG ALLOWS iControl=4 */
if (iControl < 1 || iControl > 3) {
return 1;
} else {
/* switch to remote and unlocked operation pg48 */
sprintf(pCommand,"C3");
iRet = transactRS232(self->controller, pCommand,strlen(pCommand), pReply,79);
if(iRet != 1)
{
return iRet;
}
if(pReply[0] == '?')
{
strcpy(self->pAns,pReply);
return ITC4__BADCOM;
}
/* 3 input channels see p52 */
/* BUG ALLOWS iControl=4 */
if (iControl < 1 || iControl > 3) {
return 1;
} else {
/* switch to remote and unlocked operation pg48 */
sprintf(pCommand,"C3");
iRet = transactRS232(self->controller, pCommand,strlen(pCommand), pReply,79);
if(iRet != 1)
{
return iRet;
}
if(pReply[0] == '?')
{
strcpy(self->pAns,pReply);
return ITC4__BADCOM;
}
/* Set heater and gas flow controls to manual pg51 */
sprintf(pCommand,"A0");
iRet = transactRS232(self->controller, pCommand,strlen(pCommand),
pReply,79);
if(iRet != 1)
{
return iRet;
}
if(pReply[0] == '?')
{
strcpy(self->pAns,pReply);
return ITC4__BADCOM;
}
/* Set heater and gas flow controls to manual pg51 */
sprintf(pCommand,"A0");
iRet = transactRS232(self->controller, pCommand,strlen(pCommand),
pReply,79);
if(iRet != 1)
{
return iRet;
}
if(pReply[0] == '?')
{
strcpy(self->pAns,pReply);
return ITC4__BADCOM;
}
/* Set heater sensor pg 52 */
sprintf(pCommand,"H%1.1d",iControl);
iRet = transactRS232(self->controller, pCommand,strlen(pCommand),
pReply,79);
if(iRet != 1)
{
return ITC4__BADCOM;
} else if(pReply[0] == '?')
{
strcpy(self->pAns,pReply);
return ITC4__BADCOM;
} else {
self->iControl = iControl;
}
/* Set heater sensor pg 52 */
sprintf(pCommand,"H%1.1d",iControl);
iRet = transactRS232(self->controller, pCommand,strlen(pCommand),
pReply,79);
if(iRet != 1)
{
return ITC4__BADCOM;
} else if(pReply[0] == '?')
{
strcpy(self->pAns,pReply);
return ITC4__BADCOM;
} else {
self->iControl = iControl;
}
/* Display on control sensor on front panel pg51 */
sprintf(pCommand,"F%1.1d",iControl);
iRet = transactRS232(self->controller, pCommand,strlen(pCommand),
pReply,79);
if(iRet != 1)
{
return iRet;
}
if(pReply[0] == '?')
{
strcpy(self->pAns,pReply);
return ITC4__BADCOM;
}
/* Display on control sensor on front panel pg51 */
sprintf(pCommand,"F%1.1d",iControl);
iRet = transactRS232(self->controller, pCommand,strlen(pCommand),
pReply,79);
if(iRet != 1)
{
return iRet;
}
if(pReply[0] == '?')
{
strcpy(self->pAns,pReply);
return ITC4__BADCOM;
}
/* Heater Auto, Gas Manual pg51 */
sprintf(pCommand,"A1");
iRet = transactRS232(self->controller, pCommand,strlen(pCommand),
pReply,79);
if(iRet != 1)
{
return iRet;
}
if(pReply[0] == '?')
{
strcpy(self->pAns,pReply);
return ITC4__BADCOM;
}
/* reset timeout */
/*iRet = SerialConfig(&self->pData, 10);*/
if(iRet != 1)
{
return iRet;
}
/* Heater Auto, Gas Manual pg51 */
sprintf(pCommand,"A1");
iRet = transactRS232(self->controller, pCommand,strlen(pCommand),
pReply,79);
if(iRet != 1)
{
return iRet;
}
if(pReply[0] == '?')
{
strcpy(self->pAns,pReply);
return ITC4__BADCOM;
}
/* reset timeout */
/*iRet = SerialConfig(&self->pData, 10);*/
if(iRet != 1)
{
return iRet;
}
}
return 1;
}
}
/* --------------------------------------------------------------------------*/
int ITC4_Send(pITC4 *pData, char *pCommand, char *pReply, int iLen)
@@ -443,7 +443,7 @@
strncpy(pError,"ITC4: Failed three times to write new set value to ITC4",iLen);
break;
default:
SerialError(iCode, pError,iLen);
getRS232Error(iCode, pError,iLen);
break;
}
}