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:
- 52:060fdec99780
- Parent:
- 44:4ad6133987ed
- Child:
- 62:9b34dc1b265d
diff -r fabe54861f1b -r 060fdec99780 Radio.cpp
--- a/Radio.cpp Wed Jan 13 18:58:11 2016 +0000
+++ b/Radio.cpp Thu Jan 14 05:27:44 2016 +0000
@@ -76,7 +76,7 @@
// We have been given a node id
my_node_id = em->m.value;
- writeToPhone("NID: %d\r\n", my_node_id);
+ if( Dbg ) writeToPhone("NID: %d\r\n", my_node_id);
// Now reset the radio :)
radio_init();
@@ -136,7 +136,7 @@
radio.send(em.m.cone, payload, sizeof(payload));
- writeToPhone("SND: %d %d 0x%x\r\n", em.m.cone, node_id, em.mac);
+ if( Dbg ) writeToPhone("SND: %d %d 0x%x\r\n", em.m.cone, node_id, em.mac);
}
}
@@ -149,8 +149,8 @@
return;
}
- //writeToPhone("SM: %c to: %d frm: %d (%d)\r\n", m->command, m->cone, NODE_ID, m->value); /// DEBUG-only message
-
+ //if( Dbg ) writeToPhone("SM: %c to: %d frm: %d (%d)\r\n", m->command, m->cone, NODE_ID, m->value);
+
payload[0] = (byte)m->command;
payload[4] = (byte)m->value & 255;
@@ -207,11 +207,11 @@
em.mac |= (int)radio.DATA[6] << 16;
em.mac |= (int)radio.DATA[5] << 24;
- writeToPhone("RP: 0x%x\r\n", em.mac);
+ if( Dbg ) writeToPhone("RP: 0x%x\r\n", em.mac);
if (em.mac != my_mac)
{
- writeToPhone("DM 0x%x\r\n", em.mac);
+ if( Dbg ) writeToPhone("DM 0x%x\r\n", em.mac);
return false; // This message was meant for someone else
}
@@ -223,7 +223,7 @@
{
memcpy(m, &lm, sizeof(Message));
- writeToPhone("GM: %d %c %d\r\n", radio.SENDERID, m->command, m->value); /// DEBUG-only message
+ if( Dbg ) writeToPhone("GM: %d %c %d\r\n", radio.SENDERID, m->command, m->value);
return true;
}
@@ -255,7 +255,7 @@
if (my_node_id != RADIO_STARTUP_ID && current - last_send > 1000L)
{
- writeToPhone("NID: %d\r\n", my_node_id);
+ if( Dbg ) writeToPhone("NID: %d\r\n", my_node_id);
last_send = current;
}
@@ -269,7 +269,7 @@
m.cone = 1;
m.value = my_mac;
- writeToPhone("SNM\r\n");
+ if( Dbg ) writeToPhone("SNM\r\n");
last_send = current;
