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:
- 28:8e74ddc4f70f
- Parent:
- 26:40a0c775ff27
- Child:
- 29:ae208b014987
- Child:
- 30:c60b0d52b067
--- a/Radio.cpp Thu Dec 31 17:47:15 2015 +0000
+++ b/Radio.cpp Sun Jan 03 20:05:15 2016 +0000
@@ -36,6 +36,8 @@
radio.promiscuous(promiscuousMode);
}
+
+
void radio_send(Message *m)
{
static byte payload [6] = {0};
@@ -45,7 +47,7 @@
return;
}
- //writeToPhone("Sending message: %c to: %d\r\n", m->command, m->cone);
+ writeToPhone("Sending message: %c to: %d from: %d\r\n", m->command, m->cone, NODE_ID);
payload[0] = (byte)m->command;
payload[4] = (byte)m->value & 255;
@@ -53,12 +55,8 @@
payload[2] = (byte)(m->value >> 16);
payload[1] = (byte)(m->value >> 24);
payload[5] = (byte)'%';
-
- #ifdef MASTER
- radio.send(2, payload, sizeof(payload));
- #else
- radio.send(1, payload, sizeof(payload));
- #endif
+
+ radio.send(m->cone, payload, sizeof(payload));
}
bool radio_receive_complete()
@@ -75,13 +73,13 @@
if (radio.receiveDone())
{
- //writeToPhone("Received: %d bytes", radio.DATALEN);
+ writeToPhone("Received: %d bytes", radio.DATALEN);
if (radio.DATALEN < 6)
{
return false;
}
- //writeToPhone("Got message from: %d\r\n", radio.SENDERID);
+ writeToPhone("Got message from: %d\r\n", radio.SENDERID);
m->cone = radio.SENDERID;
m->command = radio.DATA[0];
