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

Files at this revision

API Documentation at this revision

Comitter:
nikitateggi
Date:
Fri Aug 11 12:19:25 2017 +0000
Parent:
38:7238f3531ce9
Child:
40:f7f351699288
Commit message:
Code used for deployment of POC3 on 11th august 2017.

Changed in this revision

bp.cpp Show annotated file Show diff for this revision Revisions of this file
display_modules.cpp Show annotated file Show diff for this revision Revisions of this file
display_modules.h Show annotated file Show diff for this revision Revisions of this file
ecgg.cpp Show annotated file Show diff for this revision Revisions of this file
glc.cpp Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/bp.cpp	Wed Aug 02 06:58:57 2017 +0000
+++ b/bp.cpp	Fri Aug 11 12:19:25 2017 +0000
@@ -6,7 +6,7 @@
 #include "MAX30102.h" // BP ADD
 #include <string.h>
 #include <stdio.h>
-
+#include "eeprom_pgm.h"
 #include <time.h>
 #include "ds3231.h"
 #include "SDFileSystem.h"
@@ -97,7 +97,7 @@
     
     
     // Loading values of Length ,  PID, DID, sampling frequency, number of samples, calculated data.
-    BLEMsg_info_bp.device_id = 01;                   // Device ID fixed
+    BLEMsg_info_bp.device_id = eprom_read_8(12);                   // Device ID fixed  // changed on 11/8/17 nikita
     BLEMsg_info_bp.patient_id = (uint32_t)pid;       // Patient ID
     BLEMsg_info_bp.sampling_freq = 500;              // sampling frrquency
     BLEMsg_info_bp.length = 10774;                   //Total length of data in bytes  22 B+10752 B
@@ -210,6 +210,7 @@
      {
         screen_bp_error();             // checking for error out of range- nikita 10-7-17
         del_ppg_ecg_BPfile(pid);                          // Copy ECG and PPG data to BP file
+        delete_subfiles(pid);     //added on 11/8/17 nikita
      } 
     
     else 
--- a/display_modules.cpp	Wed Aug 02 06:58:57 2017 +0000
+++ b/display_modules.cpp	Fri Aug 11 12:19:25 2017 +0000
@@ -69,7 +69,7 @@
      
     
     
-    void screen_main_2(int32_t pid)     // test main screen
+   void screen_main_2(int32_t pid)     // test main screen
  {
     char buff2[10];     
     backlight = 0 ;
@@ -77,8 +77,11 @@
     TFT.background(White) ;
     sprintf(buff2 ,"%d", pid);
     TFT.fillrect(5,20,250,150,White ); 
-    TFT.fillrect(60,130,180,200,White );  
-    TFT.fillrect(60,230,180,320,White );      // changed from 300 to 320
+   TFT.fillrect(5,20,250,250,White );              // added on 11/8/17 nikita 
+   TFT.fillrect(60,130,180,200,White );  
+   TFT.fillrect(60,230,180,300,White );      // changed from 300 to 320  //changed//8/8/17
+   // TFT.fillrect(5,20,300,320,White ); 
+   TFT.fillrect(5,230,240,320,White );       // added on 11/8/17 nikita
     TFT.set_font((unsigned char*) Arial24x23);
     TFT.foreground(Black);
     TFT.locate(10,50) ;
@@ -169,6 +172,13 @@
     TFT.printf("   HeartRate   ") ;        
     TFT.locate(50,180);                            // changed from 30 
     TFT.printf(buf) ; 
+    TFT.set_font((unsigned char*) Arial12x12);   // added on 11/8/17 nikita
+    TFT.locate(5,291) ; 
+    TFT.foreground(Navy) ;
+    TFT.printf("Study Readings: Not for medical") ;           // added on 8/8/17 nikita
+    TFT.locate(35,300) ;
+    TFT.printf("diagnosis and treatment") ;
+    TFT.set_font((unsigned char*) Arial24x23);
     TFT.BusEnable(false) ;
     backlight = 1 ;
     }
@@ -179,7 +189,8 @@
     TFT.BusEnable(true) ;
     TFT.background(White) ;
     TFT.foreground(Red) ;
-    TFT.fillrect(5,90,230,150,White);  
+    //TFT.fillrect(5,90,230,150,White); 
+    TFT.fillrect(5,90,230,200,White);  // added on 11/08/2017 //nikita 
     TFT.locate(50,100) ;  
     TFT.printf("Re-check") ;   
     TFT.locate(3,130) ;  
@@ -195,7 +206,8 @@
     TFT.BusEnable(true) ;
     TFT.background(White) ;
     TFT.foreground(Red) ;
-    TFT.fillrect(5,90,230,150,White);  
+   // TFT.fillrect(5,90,230,150,White);  
+    TFT.fillrect(5,90,230,200,White);     // added on 11/08/2017 //nikita 
     TFT.locate(20,100) ;  
     TFT.printf("Re-check Leads") ;   
     TFT.locate(50,130) ;  
@@ -207,7 +219,8 @@
 }
  
   void screen_ecg_bp()            // added screen dispaly text //14/06
-  {    backlight = 0 ;
+  { 
+    backlight = 0 ;
     TFT.BusEnable(true) ;
     TFT.background(Green) ;
     TFT.fillrect(10,215,230,290,White);  
@@ -252,7 +265,7 @@
     }
     
 
- void screen_bp1(float SBP, float DBP)          // BP  screen 2
+void screen_bp1(float SBP, float DBP)          // BP  screen 2
  {
     backlight = 0 ;
     TFT.BusEnable(true) ;
@@ -261,12 +274,15 @@
     char buf[10];  
     TFT.fillrect(3,130,200,200,White);
     TFT.fillrect(60,230,180,300,White);
+    TFT.fillrect(60,110,180,250,White);
     TFT.locate(3,100) ;  
     TFT.printf(" BP Tst Done  ") ; 
-    sprintf (buf, "SBP: %.0f   ",SBP);          // changed to display 2 digits after decimal point, 2May'17 Changed to Integer
+   // sprintf (buf, "SBP: %.0f   ",SBP);          // changed to display 2 digits after decimal point, 2May'17 Changed to Integer
+    sprintf (buf, "SBP: %d   ",(uint32_t)SBP);               //changed to integer 8/8/2017
     TFT.locate(5,140) ;                         // changed 100 to 150
     TFT.printf(buf) ; 
-    sprintf (buf, "DBP: %.0f",DBP);           // changed to display 2 digits after decimal point, 2May'17, Changed to integer
+    sprintf (buf, "DBP: %d",(uint32_t)DBP);                //changed to integer 8/8/2017
+   // sprintf (buf, "DBP: %.0f",DBP);           // changed to display 2 digits after decimal point, 2May'17, Changed to integer
     TFT.locate(5,170) ;                       // CHANGED from 150 to 170
     TFT.printf(buf) ;
     //TFT.fillrect(60,230,180,300,Green);
@@ -282,11 +298,17 @@
     TFT.printf("RE-") ;  
     TFT.locate(145,255) ; 
       TFT.printf("TEST") ;  */
+    TFT.set_font((unsigned char*) Arial12x12);
+    TFT.foreground(Navy) ;
+    TFT.locate(5,291) ; 
+    TFT.printf("Study Readings: Not for medical") ;               // added on 11/8/17 nikita
+    TFT.locate(35,300) ;
+    TFT.printf("diagnosis and treatment") ;
+    TFT.set_font((unsigned char*) Arial24x23);
     TFT.BusEnable(false) ;
     backlight = 1 ; 
 }   
     
-    
                    
                 
   
@@ -335,16 +357,17 @@
 }
             
      
- void ecg_countdown()   // ECG measurement countdown 
+void ecg_countdown()   // ECG measurement countdown 
  {    
     backlight = 0 ;
     TFT.BusEnable(true) ;
     TFT.background(White) ;
     TFT.foreground(Green) ;
     char tim1[5];
-    TFT.fillrect(3,130,200,200,White);
+    TFT.fillrect(3,80,240,300,White);   //changed on 11/8/17 nikita
     TFT.fillrect(60,230,180,300,White);
     TFT.fillrect(5,215,230,290,White);
+    TFT.fillrect(5,230,240,320,White ); 
     TFT.locate(25,100) ;        
     TFT.printf("ECG starts in") ; 
     for(int i=5;i>=0;i--)
@@ -354,11 +377,16 @@
                 TFT.locate(120,120) ;        
                 TFT.printf(tim1) ; 
          }
-     TFT.BusEnable(false) ;
-     backlight = 1 ; 
+    TFT.fillrect(5,80,240,200,White);    
+    TFT.locate(35,110) ;        
+    TFT.printf("ECG Tst in") ;                  // added on 11/8/17 nikita
+    TFT.locate(50,140) ;        
+    TFT.printf("progress") ;      
+    TFT.BusEnable(false) ;
+    backlight = 1 ; 
         
       
-  }                
+  }                   
   
    void bp_countdown()   // ECG measurement countdown 
  {    
@@ -370,6 +398,7 @@
     TFT.fillrect(3,130,200,200,White);
     TFT.fillrect(60,230,180,300,White);
     TFT.fillrect(1,80,240,290,White);           //changed the points// 13/06
+    TFT.fillrect(5,230,240,320,White );    //added 11/8/17
     TFT.locate(25,100) ;        
     TFT.printf("BP starts in") ; 
     for(int i=5;i>=0;i--)
@@ -379,6 +408,12 @@
                 TFT.locate(120,120) ;        
                 TFT.printf(tim1) ; 
             }
+    TFT.fillrect(5,80,240,200,White);
+    TFT.locate(35,110) ;        
+    TFT.printf("BP Tst in") ;                        // added on 11/8/17 nikita
+    TFT.locate(50,140) ;        
+    TFT.printf("progress") ;   
+            
      TFT.BusEnable(false) ;
      backlight = 1 ; 
 } 
@@ -443,6 +478,8 @@
     TFT.fillrect(60,230,180,300,White);
     TFT.fillrect(5,215,230,290,White);
     TFT.fillrect( 130,130,220,200,White);
+    TFT.fillrect( 5,95,220,200,White);    //added 11/8/17//45 to 5  nikita
+    TFT.fillrect(5,230,240,320,White );  
     TFT.locate(5,130) ;  
     TFT.printf("Blood Glucose") ; 
     TFT.locate(5,160) ;  
@@ -493,6 +530,13 @@
     TFT.printf(buf) ; 
     TFT.locate(5,160) ;  
     TFT.printf("(Range 70-120 mg/dl)") ;   // added 16/06
+       TFT.set_font((unsigned char*) Arial12x12);
+    TFT.foreground(Navy) ;
+     TFT.locate(5,291) ; 
+    TFT.printf("Study Readings: Not for medical") ;                      // added on 11/8/17 nikita
+    TFT.locate(35,300) ;
+    TFT.printf("diagnosis and treatment") ;
+    TFT.set_font((unsigned char*) Arial24x23);
     TFT.BusEnable(false) ;
     backlight = 1 ; 
    }
@@ -569,7 +613,7 @@
     TFT.BusEnable(true) ;
     TFT.background(White) ;
     TFT.foreground(Red) ;
-    TFT.fillrect(5,90,230,150,White);  
+   TFT.fillrect(5,90,230,200,White); // added on 11/8/17 nikita 
     TFT.locate(50,100) ;  
     TFT.printf("ERROR!") ;   
     TFT.locate(20,130) ;  
@@ -674,7 +718,7 @@
     TFT.BusEnable(true) ;
     TFT.background(Green) ;
     TFT.foreground(Black) ; 
-    TFT.fillrect(5,90,230,300,White);    
+   // TFT.fillrect(5,90,230,300,White);    
     TFT.fillrect( 60,230,180,300,Green);
     TFT.locate(80,250) ;        
     TFT.printf("MAIN") ;          
@@ -707,4 +751,20 @@
     TFT.BusEnable(false) ;
     backlight = 1 ;   
     
-}
\ No newline at end of file
+}
+void glc_error_test_strip_removed()                        //glc replace test strip// // added on 8/8/17 nikita
+ {  
+     backlight = 0 ;
+    TFT.BusEnable(true) ;
+    TFT.background(White) ;
+    TFT.foreground(Red) ;
+    TFT.fillrect(5,90,230,300,White);  
+    TFT.locate(50,130);            //changed from 50 to 60 //rashmi 22/7/17// changed from 100 to 130added on 10/8/17 nikita
+    TFT.printf("Test Strip") ;   
+    TFT.locate(50,160) ;                //changed from 20 to 40 //rashmi 22/7/17// changed from 130 to 160added on 10/8/17 nikita
+    TFT.printf("Removed") ; 
+    //TFT.locate(45,160) ;  
+   // TFT.printf("") ; 
+   TFT.BusEnable(false) ;
+    backlight = 1 ;    
+  }  
\ No newline at end of file
--- a/display_modules.h	Wed Aug 02 06:58:57 2017 +0000
+++ b/display_modules.h	Fri Aug 11 12:19:25 2017 +0000
@@ -36,4 +36,5 @@
 void screen_patient_info(uint32_t current_test_pid,uint32_t  bt_file_sent_pid);
 void battery_critically_low_charge();
 void battery_low_charge();
+void glc_error_test_strip_removed();// added on 11/8/17 nikita
 #endif 
--- a/ecgg.cpp	Wed Aug 02 06:58:57 2017 +0000
+++ b/ecgg.cpp	Fri Aug 11 12:19:25 2017 +0000
@@ -12,7 +12,7 @@
 #include "rtc.h"
 #include "sdcard.h"
 #include "ec_bp.h"
-
+#include "eeprom_pgm.h"
 #include "struct.h"  // Added on 31/5/17_Nidhin
 //#include "test_type.h" //Added on  31/5/17_Nidhin
 FILE *fpeecg1; // FILE pointer to ECG file
@@ -81,7 +81,7 @@
     
     
     // Loading values of Length ,  PID, DID, sampling frequency, number of samples, calculated data.
-    BLEMsg_info_ecg.device_id = 01;                   // Device ID fixed
+    BLEMsg_info_ecg.device_id = eprom_read_8(12);                 // Device ID fixed
     BLEMsg_info_ecg.patient_id = (uint32_t)pid;       // Patient ID
     BLEMsg_info_ecg.sampling_freq = 500;              // sampling frrquency
     BLEMsg_info_ecg.length = 8022;                   //Total length of data in bytes  22 B+ 4000 data
@@ -231,6 +231,7 @@
  
 if(HR_avg>100 || HR_avg<40) 
     {
+        delete_subfiles(pid);   // added on 11/8/17 nikita
         return 1;               // out of range condition returning 1  //nikita//10/7
         }
  else 
--- a/glc.cpp	Wed Aug 02 06:58:57 2017 +0000
+++ b/glc.cpp	Fri Aug 11 12:19:25 2017 +0000
@@ -338,7 +338,7 @@
     
     
     // Loading values of Length ,  PID, DID, sampling frequency, number of samples, calculated data.
-    BLEMsg_info_glc.device_id = 01;                   // Device ID fixed
+    BLEMsg_info_glc.device_id = eprom_read_8(12);                   // Device ID fixed  // change on 11/8/17 nikita
     BLEMsg_info_glc.patient_id = (uint16_t)pid;      // Patient ID
     BLEMsg_info_glc.sampling_freq = 0;              // sampling frrquency
     BLEMsg_info_glc.length = 30;                   //Total length of data in bytes  22 B+10752 B
@@ -406,6 +406,8 @@
                                         //wait for insertion of blood;
                                     }
                             }
+                             if(test_strip)     // added on 11/8/17 nikita
+                               glc_error_test_strip_removed();   
                         wait_ms(800);          
                     }
                     
@@ -436,6 +438,7 @@
     {  
          gtc.printf("replace teststip"); 
          glc_error(); //disaply for showing error//10/7/17//nikita
+         delete_subfiles(pid); // added on 11/8/17 nikita
     }  
 
 
--- a/main.cpp	Wed Aug 02 06:58:57 2017 +0000
+++ b/main.cpp	Fri Aug 11 12:19:25 2017 +0000
@@ -50,7 +50,7 @@
 
    while(1)
    {
-           DisableTouch();
+           /*DisableTouch();
            battery_voltage_condition=battery_voltage();
     
    if (battery_voltage_condition==3)
@@ -60,7 +60,7 @@
               
                          
   else
-       {             
+       {       */      
     
      EnableTouch();
      switch(main_state)                          // main state machine
@@ -101,7 +101,7 @@
                  }
                  break;
                  
-         case 4:  
+         case 4:  DisableTouch();  
                  state_t=bt_receive(state_r);               // bluetooth receive
                  main_state=3;
                 // gc.printf("statet=%d",state_t);
@@ -119,7 +119,7 @@
     }
 }
 
-}
+//}
 
 //}