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 Motor_XYZ_UI_SPI_I2C_5mag by
Diff: parse_array/ParseArray.cpp
- Revision:
- 7:ee0569d49c52
- Parent:
- 4:5cde69a36d74
diff -r ce02d396c961 -r ee0569d49c52 parse_array/ParseArray.cpp
--- a/parse_array/ParseArray.cpp Fri Nov 10 02:39:32 2017 +0000
+++ b/parse_array/ParseArray.cpp Fri Dec 08 06:30:58 2017 +0000
@@ -192,11 +192,11 @@
return true;
}
// test xorValue
-bool ParseArray::testXOR()// set xindex as headerIndex
+bool ParseArray::testXOR(int hindex)// set xindex as headerIndex
{
int i = 0;
byte xorValue = 0 ;
- for (i = 0; i < length; i++) {
+ for (i = hindex; i < hindex+length; i++) {
xorValue ^= bufferArray[i % bufferLength];
}
if (xorValue == 0)
@@ -237,8 +237,10 @@
}
// test xorValue
if (hasCheckXOR) {
- if (!testXOR())// fail check
+ if (!testXOR(curIndex)) { // fail check
+ printf("XOR fail");
return false;
+ }
}
// pass all test
currentHeaderIndex = curIndex;
