player: use different buffer for acks
This commit is contained in:
parent
fa1d207bfe
commit
d870849e4c
|
@ -182,6 +182,7 @@ uint8_t joinGame()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
struct packet p;
|
struct packet p;
|
||||||
|
struct packet ack;
|
||||||
p.len=sizeof(p);
|
p.len=sizeof(p);
|
||||||
p.protocol='G';
|
p.protocol='G';
|
||||||
p.command='J';
|
p.command='J';
|
||||||
|
@ -195,11 +196,11 @@ uint8_t joinGame()
|
||||||
for(i=0; i<10; i++){
|
for(i=0; i<10; i++){
|
||||||
nrf_snd_pkt_crc(sizeof(p),(uint8_t*)&p);
|
nrf_snd_pkt_crc(sizeof(p),(uint8_t*)&p);
|
||||||
|
|
||||||
int len = nrf_rcv_pkt_time(30,sizeof(p),(uint8_t*)&p);
|
int len = nrf_rcv_pkt_time(30,sizeof(ack),(uint8_t*)&ack);
|
||||||
if( len==sizeof(p) ){
|
if( len==sizeof(ack) ){
|
||||||
if( (p.len==32) && (p.protocol=='G') && p.command=='a' ){ //check sanity, protocol
|
if( (ack.len==32) && (ack.protocol=='G') && ack.command=='a' ){ //check sanity, protocol
|
||||||
if( p.id == id && p.ctr == ctr ){
|
if( ack.id == id && ack.ctr == ctr ){
|
||||||
if( p.c.ack.flags & FLAGS_ACK_JOINOK ){
|
if( ack.c.ack.flags & FLAGS_ACK_JOINOK ){
|
||||||
lcdPrintln("Join OK");
|
lcdPrintln("Join OK");
|
||||||
lcdRefresh();
|
lcdRefresh();
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -233,6 +234,10 @@ uint8_t selectGame()
|
||||||
nrf_config_set(&config);
|
nrf_config_set(&config);
|
||||||
|
|
||||||
gamecount = 0;
|
gamecount = 0;
|
||||||
|
lcdClear();
|
||||||
|
lcdPrintln("Searching for");
|
||||||
|
lcdPrintln("games...");
|
||||||
|
lcdRefresh();
|
||||||
for(i=0;i<60;i++){
|
for(i=0;i<60;i++){
|
||||||
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)){
|
||||||
|
|
Loading…
Reference in New Issue