Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of football_project by
Diff: Radio.cpp
- Revision:
- 70:bd4b1e19a0c6
- Parent:
- 69:a3295b74209e
- Child:
- 73:ac3588017e32
diff -r a3295b74209e -r bd4b1e19a0c6 Radio.cpp
--- a/Radio.cpp Fri Feb 12 21:13:14 2016 +0000
+++ b/Radio.cpp Mon Feb 22 09:48:42 2016 +0000
@@ -265,7 +265,7 @@
em.mac |= (int)radio.DATA[7] << 8;
em.mac |= (int)radio.DATA[6] << 16;
em.mac |= (int)radio.DATA[5] << 24;
-
+
if( Dbg ) writeToPhone("RP: 0x%x\r\n", em.mac);
if (em.mac != my_mac)
@@ -273,7 +273,7 @@
if( Dbg ) writeToPhone("DM 0x%x\r\n", em.mac);
break; // This message was meant for someone else
}
-
+
memcpy(&em.m, &lm, sizeof(Message));
slave_process(&em);
}
@@ -327,7 +327,7 @@
if( RF69_MODE_RX != radio._mode )
{
// Either do this or change the setMode in RFM69.cpp at end of sendFrame() to setMode(RF69_MODE_RX);
- radio.receiveDone(); //// Prevent radio from going to standby or sleep. (Should never return true here.)
+ while( radio.receiveDone() ); //// Prevent radio from going to standby or sleep. (Shouldn't return true here.)
}
}
@@ -340,10 +340,25 @@
bool radio_ack_received( int cone )
{
- bool retval = radio.ACKReceived(cone);
+////bool retval = radio.ACKReceived(cone);
+ bool retval = radio.receiveDone();
+
+ if( !get_crc_ok() )
+ {
+ writeToPhone( "BAD-CRC on ACK wait\r\n" );
+ retval = false;
+ }
if( retval )
{
+ if( !((radio.SENDERID == cone || cone == RF69_BROADCAST_ADDR) && radio.ACK_RECEIVED) )////...
+ {
+ // Got something that wasn't expected ACK. (Paranoia--Haven't seen this happen yet.)
+ RA_DEBUG( "Got '%c', not ACK!\r\n", (char)radio.DATA[0] );
+ RA_DEBUG( "Wanted from %u, got from %u\r\n", cone, radio.SENDERID );
+ retval = false;
+ }
+
if( radio.TARGETID == datastore_node_id() )
{
stompage_check();
