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:
- 32:64e5d7340d82
- Parent:
- 31:a6110950f385
- Child:
- 33:0fa936c5a098
--- a/Radio.cpp Tue Jan 05 13:05:48 2016 +0000
+++ b/Radio.cpp Wed Jan 06 16:39:59 2016 +0000
@@ -47,7 +47,7 @@
return;
}
- writeToPhone("Sending message: %c to: %d from: %d\r\n", m->command, m->cone, NODE_ID); /// DEBUG-only message
+ writeToPhone("SM: %c 2: %d frm: %d\r\n", m->command, m->cone, NODE_ID); /// DEBUG-only message
payload[0] = (byte)m->command;
payload[4] = (byte)m->value & 255;
@@ -73,19 +73,21 @@
if (radio.receiveDone())
{
- writeToPhone("Received: %d bytes", radio.DATALEN); /// DEBUG-only message
+ //writeToPhone("Received: %d bytes", radio.DATALEN); /// DEBUG-only message
if (radio.DATALEN < 6)
{
return false;
}
- writeToPhone("Got message from: %d\r\n", radio.SENDERID); /// DEBUG-only message
-
- m->cone = radio.SENDERID;
- m->command = radio.DATA[0];
- m->value = radio.DATA[1];
-
- return true;
+ writeToPhone("GM: %d\r\n", radio.SENDERID); /// DEBUG-only message
+ if (radio.TARGETID == NODE_ID)
+ {
+ m->cone = radio.SENDERID;
+ m->command = radio.DATA[0];
+ m->value = radio.DATA[1];
+
+ return true;
+ }
}
return false;
