Updated with option to return from BP screen to main screen, resolved screen navigation issues

Dependencies:   SDFileSystem TFTLCD_8bit ds3231 program mbed

Fork of poc_dis_5 by SenseSemi

Revision:
3:9a06c2bed650
Parent:
2:3b7b71bfc941
Child:
4:6bd81bb1790d
diff -r 3b7b71bfc941 -r 9a06c2bed650 main.cpp
--- a/main.cpp	Mon Jan 30 10:57:38 2017 +0000
+++ b/main.cpp	Fri Feb 10 10:39:13 2017 +0000
@@ -6,6 +6,7 @@
 #include "ecg_dec.h"
 #include "touch_modules.h"
 #include "glc.h"
+#include "bp.h"
 #include "sdcard.h"
 
 
@@ -20,16 +21,16 @@
 int main(){
 
 
-unsigned char state;
-unsigned char state1;
-unsigned char nstate;
-unsigned char nstate1;
-int pid=0;
-unsigned char flag=0;
-unsigned char ecg_flag=0;
-unsigned char glc_flag=0;
+ unsigned char state;
+ unsigned char state1;
+ unsigned char nstate;
+ unsigned char nstate1;
+ int pid=0;                // patient ID
+ unsigned char flag=0;
+ unsigned char ecg_flag=0;
+ unsigned char glc_flag=0;
 
-  unsigned int mgdll;   
+  
    DisableTouch();
    gc.baud(115200);
   
@@ -42,19 +43,20 @@
 
    while(1)
    {
-      detect_touch();     // detrmine the touch points
+      
+    detect_touch();     // detrmine the touch points
     
     switch(state)
   {
       case 1:   state1=touch_main();   // determining the touch for main screen 
                 state=0;
                 nstate1=state1;
-                break;
+                 break;
                
       case 2: 
                 state1=touch_main_1();    // determining the touch for glc screen 
                 state=0;
-                 nstate1=state1;
+                nstate1=state1;
                 break;
                 
       case 3:  
@@ -73,14 +75,12 @@
       case 5: 
                 state1=touch_ecg();     // determining the touch for bp screen 
                 state=0;
-               nstate1=state1;
-                break;   
+                nstate1=state1;
+                 break;   
     case 6: 
                 state1=touch_ret();     // determining the touch for bp screen 
                 state=0;
-               nstate1=state1;
-              // gc.printf("state=%d", state);
-               //gc.printf("state1=%d", state1);
+                nstate1=state1;
                 break;
                 
     case 7: 
@@ -89,20 +89,25 @@
                 nstate1=state1;
                 break;
                 
+     case 8:    
+                state1=touch_bp();     // determining the touch for bp screen 
+                state=0;
+                nstate1=state1;
+                break;           
+                
+                
+                
      case 10 :  DisableTouch();
                  wait_ms(300);
                  EnableTouch();
-                  state=nstate;
-                 // gc.printf("%d", nstate);
-                 //state=0;
-                break;
+                 state=nstate;
+                  break;
                 
       default :  DisableTouch();
                  wait_ms(300);
                  EnableTouch();
-                  state=nstate;
-                 // gc.printf("%d", nstate);
-                   break;          
+                 state=nstate;
+                  break;          
                           
     }         
      
@@ -116,13 +121,11 @@
       case 0: 
                 DisableTouch();
                  wait_ms(300);
-                
                   state=nstate;
-                   EnableTouch();
-                
+                 EnableTouch();
                 break;
       
-      case 1: 
+      case 1: DisableTouch();
                 screen_main(); // glc main screen 
                 state1=0;
                 state=1;
@@ -130,19 +133,18 @@
                 flag=0;
                 ecg_flag=0;
                 glc_flag=0;
-                
+                EnableTouch();
                 break;
       
-      case 2: 
+      case 2: DisableTouch();
                 screen_main_1();  // glc main screen 
                 state1=0;
                 state=2;
                 nstate=state;
-                
-                
+                EnableTouch();
                 break;
                
-      case 3: 
+      case 3: DisableTouch();
               if (flag==0)
               {
                 pid=pid+1; 
@@ -163,9 +165,10 @@
                  state1=0;
                  state=3;
                  nstate=state;
+                 EnableTouch();
                   break;
                 
-      case 4: 
+      case 4: DisableTouch();
                if (glc_flag==1)
                {
                   screen_again();   //bp main screen 
@@ -179,10 +182,12 @@
                  state=4;
                  nstate=state;
                  }
+                EnableTouch();
+                
                 break;
      
      
-     case 5:    
+     case 5:     DisableTouch();
                if (ecg_flag==1)
                {
                   screen_again();
@@ -198,20 +203,36 @@
                    state=5;
                     nstate=state;
                     }
+                   EnableTouch();
                 break;
      
-     case 7:       
+     case 6:   DisableTouch();
+               screen_bp();
+               EnableTouch();
+                state1=0;
+                state=8;
+                break;
+     
+     
+     
+     
+     
+     case 7:    DisableTouch();
                 glc(pid);
                 
                 
                 glc_flag=1;
                 wait(5); 
               //   glc_4(mgdll);  
-               state1=9;
+               state1=0;
+                 screen_glc_2();
+              
+                state=6;;
               //  gc.printf("%d", state);
+               EnableTouch();
                 break;
     
-    case 8:     
+    case 8:     DisableTouch();
     
                ecg_countdown();
                 ecg(pid);
@@ -220,20 +241,36 @@
                 state=6;
                  nstate=state;
                  ecg_flag=1;
+              
                //    ble.printf("ecg");
+               EnableTouch();
                 break;
      
      
      case 9: 
-                
+                DisableTouch();
                screen_glc_2();
                state1=0;
                 state=6;
                 nstate=state;
-     
-     
+                EnableTouch();
                  break;
+        
+     case 11: 
+                DisableTouch();
+                screen_bp2();
+                bp();
+                state1=0;
+               // wait(1);
+                state=6;
+                nstate=state;
+                EnableTouch();
+                 break;
+        
+        
+        
         default :  
+                  
                   state1=nstate1;
                    break;