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