View Single Post
  #81   Spotlight this post!  
Unread 13-06-2002, 21:41
DanL DanL is offline
Crusty Mentor
FRC #0097
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: Somerville, MA
Posts: 682
DanL is just really niceDanL is just really niceDanL is just really niceDanL is just really niceDanL is just really nice
Send a message via AIM to DanL
ahhhh, now I see what you were talking about all along!

Just I don't like the fact that you overlap 2 packets into one... yeah it's too high to pick up, but just so I know I have an understanding of packets, this code would make it get the full packet, right?
Code:
int i;
int start;
unsigned char info[26];
for(int i=0; i <=24; i++){
  if(readBuff[i]==255 && readBuff[i+1]==255){  //packets start with 255,255
  start=i;
  break;
  }
}

for(int i=start; i<=25; i++){
  info[i-start]=readBuff[i];
}

unsigned char remainingBuffer[start];
ReadFile (hSerial, remainingBuffer, start, &read, 0);
for (int j=0; j<start; j++) {
  info[26-start+j]=remainingBuffer[j];
}
__________________
Dan L
Team 97 Mentor
Software Engineer, Vecna Technologies