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;
p.len=sizeof(p);
p.protocol='G';
p.command='J';
p.id= id;
p.ctr= ++ctr;
p.c.join.gameId=gameId;
lcdClear();
lcdPrintln("Joining game");
lcdRefresh();
for(i=0; i<10; i++){ for(i=0; i<10; i++){
lcdClear(); nrf_snd_pkt_crc(sizeof(p),(uint8_t*)&p);
lcdPrintln("Joining game");
lcdRefresh();
p.len=sizeof(p); int len = nrf_rcv_pkt_time(30,sizeof(p),(uint8_t*)&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();
int len;
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 :(");