Maxim Integrated's IoT development kit.

Dependencies:   MAX30101 MAX30003 MAX113XX_Pixi MAX30205 max32630fthr USBDevice

Revision:
6:aeb5a4c194c3
Parent:
5:ff721fa88519
Child:
7:2c9c8b6a28a7
--- a/main.cpp	Mon Mar 19 17:22:37 2018 +0300
+++ b/main.cpp	Tue Mar 20 16:28:33 2018 +0300
@@ -509,18 +509,13 @@
 					/* Convert read bytes into samples */
 					for (idx = 0; idx < readBytes; idx+=9) {
 						if (r >= 500 || ir >= 500 || g >= 500) {
-							daplink.printf("Overflow!");
-						}
-
-						if (readBytes >= (idx + 2)) {
-							redData[r++] = ((fifoData[idx] << 16) | (fifoData[idx + 1] << 8) | (fifoData[idx + 2])) & 0x03FFFF;
-						}
-
-						if (readBytes >= (idx + 5)) {
-							irData[ir++] = ((fifoData[idx + 3] << 16) | (fifoData[idx + 4] << 8) | (fifoData[idx + 5])) & 0x03FFFF;
+							daplink.printf("Overflow! r=%d ir=%d g=%d\r\n", r, ir, g);
+							break;
 						}
 
 						if (readBytes >= (idx + 8)) {
+							redData[r++] = ((fifoData[idx] << 16) | (fifoData[idx + 1] << 8) | (fifoData[idx + 2])) & 0x03FFFF;
+							irData[ir++] = ((fifoData[idx + 3] << 16) | (fifoData[idx + 4] << 8) | (fifoData[idx + 5])) & 0x03FFFF;
 							greenData[g++] = ((fifoData[idx + 6] << 16) | (fifoData[idx + 7] << 8) | (fifoData[idx + 8])) & 0x03FFFF;
 						}
 					}