//Flush serial port B & C input buffer
serBrdFlush();
serCrdFlush();
//Wait for the Heading message from compass card and convert to an integer
while ((n = serBread(HeadIn, MAXSIZE-1, TIMEOUT)) == 0) ;
HeadIn[n] = 0;
HDGMAG = atoi(HeadIn);
CTS = WPHEAD;
printf("cts = %f\n",CTS);
/*Apply magnetic dev and var corrections and determine velocity and time average hdg.*/
HDGTRU = HDGMAG + DEV + VAR;
if (SOG > 1) Speed = SOG;
else Speed = 0;
if (fabs(AVGCSE - HDGTRU) >= 20) AVGCSE = HDGTRU;
AVGCSE = (AVGCSE + HDGTRU + Speed*COG)/(2+Speed);
ABSDIFF = fabs(AVGCSE-CTS);
DIFF =(AVGCSE-CTS);
}
}
Comentarios a estos manuales