Changes done in ECG and BT

Dependencies:   SDFileSystem ds3231 eeprom_Nikita mbed testUniGraphic_150217

Fork of merged_code2_20sept_2017_4th_oct_2017 by nikita teggi

Revision:
40:f7f351699288
Parent:
39:69b09bd87502
Child:
41:1141a75eacc4
--- a/ecgg.cpp	Fri Aug 11 12:19:25 2017 +0000
+++ b/ecgg.cpp	Sun Aug 20 16:21:54 2017 +0000
@@ -15,6 +15,11 @@
 #include "eeprom_pgm.h"
 #include "struct.h"  // Added on 31/5/17_Nidhin
 //#include "test_type.h" //Added on  31/5/17_Nidhin
+
+#define MAX_HR_THRESHOLD 205
+#define MIN_HR_THRESHOLD 25
+
+
 FILE *fpeecg1; // FILE pointer to ECG file
 Serial pc(USBTX,USBRX);  
 
@@ -220,16 +225,16 @@
  // ---------------------- To average individual HRs for higher number of samples -----------------------
  for(uint16_t i = 0;i < n-1;i++)
  {
- HR_sum = HR[i]+HR_sum; 
+ HR_sum = HR[i] + HR_sum; 
  }
- HR_avg = HR_sum/(n-1); // To find average of all the individual HRs calculated
+ HR_avg = (HR_sum / (n-1)); // To find average of all the individual HRs calculated
  printf("Heart Rate sum is = %f\n",HR_sum);
  printf("Heart Rate avg is = %f\n",HR_avg);
  
  fclose(fpeecg1);
  pc.printf("temporary file closed\n"); 
  
-if(HR_avg>100 || HR_avg<40) 
+if(HR_avg > MAX_HR_THRESHOLD || HR_avg < MIN_HR_THRESHOLD) 
     {
         delete_subfiles(pid);   // added on 11/8/17 nikita
         return 1;               // out of range condition returning 1  //nikita//10/7