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: proto_code.cpp
- Revision:
- 45:1eb335c00cb2
- Parent:
- 43:6eeb44bee87e
- Child:
- 46:28c29ef61276
diff -r 6eeb44bee87e -r 1eb335c00cb2 proto_code.cpp
--- a/proto_code.cpp Sat Jan 09 12:59:34 2016 +0000
+++ b/proto_code.cpp Sat Jan 09 22:36:55 2016 +0000
@@ -10,7 +10,6 @@
#define ENABLE_3 p8
#define DEBUG_BAUD 57600 //57600
-#define MAX_LEN 24 // buffer input commands up to this length
#define NUM_CONES 3
#define STATIONS 20 // max length of a pattern
#define SEQUENCES 9 // number of patterns to store
@@ -668,9 +667,10 @@
int buffer_counter = 0;
static char parameter = '_';
static char buffer[MAX_LEN + 1];
+ static char trashArea[MAX_LEN + 1];
int value = 0;
char *endp = NULL;
-
+
// listen for commands coming over bluetooth
while (buffer_counter < size)
{
@@ -845,7 +845,7 @@
case 'B': // After setting bits, echo back station data.
l = (uint8_t)value;
masks[station-1] = l;
- writeToPhone( "%c%02d;C%02d;T%05d;B%02x\r\n", (1==station) ? 'P' : 'S',
+ writeToPhone( "%c%02u;C%02u;T%05u;B%02x\r\n", (1==station) ? 'P' : 'S',
(1==station) ? active_sequence +1 : station,
cones[station-1], times[station-1], l );
break;
@@ -861,12 +861,12 @@
writeToPhone("Pattern is %d:\r\n", active_sequence+1); // PROTOCOL optimization
for(int i=0; i<STATIONS; i++){
// writeToPhone("Station %d: cone %d, ", i+1, cones[i]);
- writeToPhone("S%02d,C%02d", i+1, cones[i]); // PROTOCOL optimization
+ writeToPhone("S%02u,C%02u", i+1, cones[i]); // PROTOCOL optimization
split = times[i];
// printMsAsSeconds(split); // Removed for PROTOCOL optimization
//Serial.print(F("s timeout, lights: "));
// writeToPhone("s timeout, config bits: ");
- writeToPhone(",T%05d", split); // PROTOCOL optimization
+ writeToPhone(",T%05u", split); // PROTOCOL optimization
l = masks[i];
/*
if(l<0b10000000)
