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.
Diff: main.cpp
- Revision:
- 3:eb3c3c9587d7
- Parent:
- 2:e35627187804
- Child:
- 4:73f9fd797965
--- a/main.cpp Mon Oct 28 10:28:21 2013 +0000
+++ b/main.cpp Mon Oct 28 11:46:30 2013 +0000
@@ -83,20 +83,24 @@
//TODO: check for overflow
if ((1 << 6) & bytes[0]) {
- printf("Overflow x!\n\r");
+ //printf("Overflow x!\n\r");
+ bytenum = -1;
}
- if ((1 << 7) & bytes[0]) {
- printf("Overflow y!\n\r");
- printf("Byte1 is %d\n\r", bytes[0]);
+ else if ((1 << 7) & bytes[0]) {
+ //printf("Overflow y!\n\r");
+ //printf("Byte1 is %d\n\r", bytes[0]);
+ bytenum = -1;
}
// check x and y signs
- int x = bytes[1] - ((bytes[0] << 4) & 0x100);
- int y = bytes[2] - ((bytes[0] << 3) & 0x100);
- //printf("%s: x = %d y = %d\n\r", id, x, y);
- sensorXs[ind] = x;
- sensorYs[ind] = y;
- sensorToPrint[ind] = true;
- bytenum = -1;
+ else {
+ int x = bytes[1] - ((bytes[0] << 4) & 0x100);
+ int y = bytes[2] - ((bytes[0] << 3) & 0x100);
+ //printf("%s: x = %d y = %d\n\r", id, x, y);
+ sensorXs[ind] = x;
+ sensorYs[ind] = y;
+ sensorToPrint[ind] = true;
+ bytenum = -1;
+ }
}
return (bytenum + 1) % 3;
}