From 8978eca3fa297b706aaaafcf666963832848823f Mon Sep 17 00:00:00 2001 From: schneider Date: Fri, 16 Dec 2011 01:15:25 +0100 Subject: [PATCH] r_player: cleanup --- firmware/l0dable/r_player.c | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/firmware/l0dable/r_player.c b/firmware/l0dable/r_player.c index fb46308..5366215 100644 --- a/firmware/l0dable/r_player.c +++ b/firmware/l0dable/r_player.c @@ -161,25 +161,20 @@ uint8_t joinGame() { int i; 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++){ - lcdClear(); - lcdPrintln("Joining game"); - lcdRefresh(); + nrf_snd_pkt_crc(sizeof(p),(uint8_t*)&p); - 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(); - - - 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 :(");