CSE477 / swimate_v2

Dependencies:   Adafruit_GFX_128x64 DS3231 PinDetect SDFileSystem USBDevice mbed RealtimeMath MODSERIAL

Revision:
9:a711b5b34d73
Parent:
8:8430a5c0914c
Child:
15:002bac432234
--- a/process_data.cpp	Tue May 20 00:43:55 2014 +0000
+++ b/process_data.cpp	Wed May 28 00:04:08 2014 +0000
@@ -3,6 +3,8 @@
 #include "SystemTime.h"
 #include "debug.h"
 
+#define THRESH 10000
+
 int window = 0;
 int16_t *history;
 int16_t prev_data = 0;
@@ -84,7 +86,7 @@
     avg[1] = avg[2];
     avg[2] = m;
 
-    if ( (avg[0] > avg[1]) && (avg[2] > avg[1]) && (avg[2] < -2000) && (avg[1] < -2000) && (avg[0] < -2000) ) {
+    if ( (avg[0] < avg[1]) && (avg[2] < avg[1]) && (avg[2] > THRESH) && (avg[1] > THRESH) && (avg[0] > THRESH) ) {
         PC_PRINTLNF("Peak detected @ %d", split_timer.read_ms());
         return true;
     }