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:
31:0f67acfc6236
Parent:
29:7edc76b15e3d
Child:
33:a80eed071fdc
--- a/main.cpp	Sat Jul 08 12:06:16 2017 +0000
+++ b/main.cpp	Sat Jul 15 05:39:45 2017 +0000
@@ -18,7 +18,8 @@
 DigitalIn q(PTC5);
 DigitalIn q3(PTC12);
 DigitalIn BT(PTA5);                     //bluetooth status pin
-  
+static uint32_t current_test_pid=0;
+static uint32_t  bt_file_sent_pid=0; 
 uint8_t touch(uint8_t state);           // touch state
 uint8_t display(uint8_t state1);       //  display state
 int32_t pid=0;                // patient ID
@@ -94,11 +95,16 @@
          case 3: DisableTouch();                             // bluetooth send 
                  if(BT==1)
                  {
+                    
+                    BT_connection() ;    // displaying connection on bluetooth 
                     state_r=bt_send(state_t);
                     main_state=4;
                  }
                else   
+               {
+                 BT_no_connection();  
                  gc.printf("timeout");
+                 }
                  break;
                  
          case 4:  
@@ -107,8 +113,11 @@
                 // gc.printf("statet=%d",state_t);
                  if(state_t ==0)
                  {
+                    BT_finished();
+                    screen_BT_return();  
                     EnableTouch();
                     main_state=1;
+                    state_touch=12;  // jumping to touch case 12
                    } 
                  break;    
                 
@@ -196,6 +205,10 @@
                  nstate1=state1;
                  break;
       
+      case 12:   state1=BT_return();            
+                 state=0;
+                 nstate1=state1;
+                 break;
       
      default :  DisableTouch();
                  wait_ms(300);
@@ -341,7 +354,11 @@
                        gc.printf("hi");
                        screen_ecg_lead();  
                      }
-                     
+                else if(heart_rate==1)   // if heart rate goes above or below range display error // 10/7/17 nikita
+                     {
+                          screen_ecg_error();
+                         
+                         }      
                      else 
                      {
                         gc.printf("hif");
@@ -377,9 +394,24 @@
                 nstate=state;
                 EnableTouch();
                  break;
-        
-               
-                 
+ 
+                          
+      case 10 :  DisableTouch();
+                 wait_ms(300);
+                 EnableTouch();
+                 state=nstate;
+                  break;        
+                  
+      case 11 :    DisableTouch();
+                   current_test_pid=eprom_read(1);
+                   bt_file_sent_pid=eprom_read(6);
+                   screen_patient_info(current_test_pid, bt_file_sent_pid);
+                   state1=0;
+                   state=12;
+                   EnableTouch();
+                   break;           
+                     
+       
         default :  
                   
                   state1=nstate1;