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:
22:ffa88619551d
Parent:
20:7c64e6ecad76
Child:
24:d992ee8369f4
diff -r 7ef1b0b40841 -r ffa88619551d glc.cpp
--- a/glc.cpp	Wed Jun 21 08:39:10 2017 +0000
+++ b/glc.cpp	Fri Jun 23 07:25:24 2017 +0000
@@ -251,7 +251,7 @@
 void Compute()
 {
    
-   
+   flipper.detach();     // ticker for sampling is disabled
    datafinal1 = (uint16_t ) NUMB1*(data2*VREF/(TOTAL))-NUMB2;
    datafinal2 = (uint16_t ) NUMB1*(daata1*VREF/(TOTAL))-NUMB2;
    mgdl = (uint16_t) NUMB1*(((daata1+data2)/2)*VREF/(TOTAL))-NUMB2;  // Nidhin 5/6/17 mgdl = (uint16_t) NUMB1*(((daata1+data2)/2)*VREF/(TOTAL))-NUMB2;
@@ -262,35 +262,25 @@
     {
         
         glc_4(mgdl);
-        mgdll = mgdl;      // Nidhin 31/5/2017
-        //gtc.printf("The Result is - %d", mgdll);
-        //sd_write(mgdl);        // storing value into the sd card
-        //sd_close();
-       // ble.printf("blood glucose is %d mg/dl", mgdl);
-        flipper.detach();
-        flipper1.detach();
-      //  return mgdl;
-      
-   
+         
     }
     
     else
-{
+   {
        // gtc.printf("err=1\n"); Commented Nidhin 8/6/2017
-        
-        // lcd1.Print( " ERROR RESULT", 5,220,COLOR_RED,COLOR_BLACK, 0);    
-         //  ble.printf("E:");
-    }
+
+     }
    GLC_START = 0;
+   flipper1.detach();// ticker for computation is disabled
 }
 
 
-void  glc(int pid){
+void  glc(int32_t pid){
    
     char t_s_d = 0;
-     i2c_spec();        
+     i2c_spec();         // programming the i2c expander 
      
-sd_open_GLCfilee(pid);                     // Opens GLC file in APPEND mode
+     sd_open_GLCfilee(pid);                     // Opens GLC file in APPEND mode
    
     // Bluetooth Structure created globally
     BLEMsg_info *ptr_BLEMsg_info_glc, BLEMsg_info_glc; // A copy of master strcuture [ "BLEMsg_info" ] by name "BLEMsg_info_bp" is created
@@ -422,6 +412,9 @@
                       //gtc.printf("mgdl is - %d\n", mgdll);
             } 
         wait(2.25);
+        
+   if (err==0)
+   {     
         gtc.printf("DATA1 is - %d\n", data1n); 
         gtc.printf("DATA2 is - %d\n", data2n);  
         gtc.printf("mgdl is - %d\n", mgdll);   
@@ -438,11 +431,14 @@
             
         structure_file(ptr_BLEMsg_info_glc, pid);           // Copy the structure into the GLC file 
         glcfile_mainfile(pid); 
-        
+       }
+     else 
+    {  
+         gtc.printf("replace teststip"); 
     }  
 
 
-    
+ }