r_player: cleanup

This commit is contained in:
schneider 2011-12-16 01:15:25 +01:00
parent d388a0b335
commit 8978eca3fa
1 changed files with 11 additions and 17 deletions

View File

@ -161,25 +161,20 @@ uint8_t joinGame()
{
int i;
struct packet p;
for(i=0; i<10; i++){
lcdClear();
lcdPrintln("Joining game");
lcdRefresh();
p.len=sizeof(p);
p.protocol='G';
p.command='J';
p.id= id;
p.ctr= ++ctr;
p.c.join.gameId=gameId;
int r = nrf_snd_pkt_crc(sizeof(p),(uint8_t*)&p);
//lcdPrint("send: "); lcdPrintInt(r);lcdPrintln("");
//lcdRefresh();
lcdClear();
lcdPrintln("Joining game");
lcdRefresh();
for(i=0; i<10; i++){
nrf_snd_pkt_crc(sizeof(p),(uint8_t*)&p);
int len;
len = nrf_rcv_pkt_time(30,sizeof(p),(uint8_t*)&p);
int len = nrf_rcv_pkt_time(30,sizeof(p),(uint8_t*)&p);
if( len==sizeof(p) ){
if( (p.len==32) && (p.protocol=='G') && p.command=='a' ){ //check sanity, protocol
if( p.id == id && p.ctr == ctr ){
@ -197,7 +192,6 @@ uint8_t joinGame()
}
}
}
delayms(70);
}
lcdPrintln("timeout :(");