Fix all the following issues which we faced during 01st April internal demo 1) Display hang and jump issue 2) Sequencing issue 3) Issue with BP code
Dependencies: SDFileSystem ds3231 program mbed testUniGraphic_150217
Fork of Int_Demo_01Apr2017_newdisplaycode_bp_nikita by
main.cpp
00001 #include "mbed.h" 00002 //#include "ili9325.h" 00003 //#include "lcd_base.h" 00004 #include "display_modules.h" 00005 #include "touch_modules.h" 00006 #include "ecg_dec.h" 00007 #include "touch_modules.h" 00008 #include "glc.h" 00009 #include "bp.h" 00010 #include "sdcard.h" 00011 #include "eeprom_pgm.h" 00012 00013 00014 Serial gc(USBTX, USBRX); 00015 DigitalIn q1(PTB11); 00016 DigitalIn q(PTB8); 00017 //Serial ble(PTC4,PTC3); 00018 00019 00020 00021 int main(){ 00022 00023 00024 unsigned char state; 00025 unsigned char state1; 00026 unsigned char nstate; 00027 unsigned char nstate1; 00028 int pid=0; // patient ID 00029 unsigned char flag=0; 00030 unsigned char ecg_flag=0; 00031 unsigned char glc_flag=0; 00032 00033 00034 DisableTouch(); 00035 gc.baud(115200); 00036 00037 init_screen(); //initialize lcd 00038 screen_main(); // display of main screen 00039 state=1; 00040 flag=0; 00041 nstate=state; 00042 EnableTouch(); // enable touch function 00043 00044 while(1) 00045 { 00046 00047 detect_touch(); // determine the touch points 00048 00049 switch(state) // state for touch 00050 { 00051 case 1: state1=touch_main(); // determining the touch for main screen 00052 state=0; 00053 nstate1=state1; 00054 break; 00055 00056 case 2: 00057 state1=touch_main_1(); // determining the touch for SYSTEM CONFIGURATION screen 00058 state=0; 00059 nstate1=state1; 00060 break; 00061 00062 case 3: 00063 state1=touch_main_2(); //// determining the touch for TEST screen 00064 00065 state=0; 00066 nstate1=state1; 00067 break; 00068 00069 case 4: 00070 state1=touch_glc(); // determining the touch for GLC screen 00071 state=0; 00072 nstate1=state1; 00073 break; 00074 00075 case 5: 00076 state1=touch_ecg(); // determining the touch for ECG screen 00077 state=0; 00078 nstate1=state1; 00079 break; 00080 case 6: 00081 state1=touch_ret(); // determining the touch for returning back to the main screen 00082 state=0; 00083 nstate1=state1; 00084 break; 00085 00086 case 7: 00087 state1=touch_again_ecg(); // determining the touch when readings are taken more than once screen 00088 state=0; 00089 nstate1=state1; 00090 break; 00091 00092 case 8: 00093 state1=touch_bp(); // determining the touch for BP screen 00094 state=0; 00095 nstate1=state1; 00096 break; 00097 00098 case 9: state1=touch_again_glc(); 00099 state=0; 00100 nstate1=state1; 00101 break; 00102 00103 case 10 : DisableTouch(); 00104 wait_ms(300); 00105 EnableTouch(); 00106 state=nstate; 00107 break; 00108 00109 00110 case 11: state1=touch_again_bp(); 00111 state=0; 00112 nstate1=state1; 00113 break; 00114 00115 00116 default : DisableTouch(); 00117 wait_ms(300); 00118 EnableTouch(); 00119 state=nstate; 00120 break; 00121 00122 } 00123 00124 00125 00126 00127 00128 switch(state1) // state for display screens 00129 { 00130 00131 00132 case 1: DisableTouch(); 00133 screen_main(); // main screen 00134 state1=0; 00135 state=1; 00136 nstate=state; 00137 flag=0; 00138 ecg_flag=0; // ecg, glc flag to determine whether the readings are taken more than once 00139 glc_flag=0; 00140 EnableTouch(); 00141 break; 00142 00143 case 2: DisableTouch(); 00144 screen_main_1(); // System configration screen 00145 state1=0; 00146 state=2; 00147 nstate=state; 00148 EnableTouch(); 00149 break; 00150 00151 case 3: DisableTouch(); 00152 if (flag==0) 00153 { 00154 //pid=pid+1; 00155 pid=eprom_read(1); // reading the patient id from eeprom 00156 pid=pid+1; 00157 eprom_write(1,pid); // writing the patient id to eeprom 00158 screen_main_2(pid); 00159 sd_open_GLCfilee(pid); // only opening the glc,bp and ecg file 00160 sd_close(); 00161 sd_open_ECGfilee(pid); 00162 sd_close(); 00163 sd_open_BPfilee(pid); 00164 sd_close(); 00165 flag=1; 00166 } 00167 else 00168 { 00169 screen_main_2(pid); // TEST screen 00170 } 00171 00172 state1=0; 00173 state=3; 00174 nstate=state; 00175 EnableTouch(); 00176 break; 00177 00178 case 4: DisableTouch(); 00179 if (glc_flag==1) // glc_flag=1 when already the reading has been taken 00180 { 00181 screen_again(); 00182 state1=0; 00183 state=9; 00184 nstate=state; 00185 } 00186 else 00187 { screen_glc(); // glc screen 00188 state1=0; 00189 state=4; 00190 nstate=state; 00191 } 00192 EnableTouch(); 00193 00194 break; 00195 00196 00197 case 5: DisableTouch(); 00198 if (ecg_flag==1) 00199 { 00200 screen_again(); 00201 state1=0; 00202 state=7; 00203 nstate=state; 00204 } 00205 00206 else 00207 { 00208 screen_ecg(); //ecg main screen 00209 state1=0; 00210 state=5; 00211 nstate=state; 00212 } 00213 EnableTouch(); 00214 break; 00215 00216 case 6: DisableTouch(); 00217 screen_bp(); // bp main screen 00218 //EnableTouch(); 00219 state1=0; 00220 state=8; 00221 nstate=state; /////// 00222 EnableTouch(); /////// 00223 break; 00224 00225 00226 00227 00228 00229 case 7: DisableTouch(); 00230 glc(pid); // glc measurement 00231 glc_flag=1; 00232 wait(5); 00233 state1=0; 00234 screen_glc_2(); 00235 state=6;; 00236 // gc.printf("%d", state); 00237 nstate=state; ////////////// 00238 EnableTouch(); 00239 break; 00240 00241 case 8: DisableTouch(); 00242 ecg_countdown(); // countdown before ecg capture 00243 ecg(pid); // capturing ecg 00244 state1=0; 00245 screen_ecg_2(); 00246 state=6; 00247 nstate=state; 00248 ecg_flag=1; 00249 // ble.printf("ecg"); 00250 EnableTouch(); 00251 break; 00252 00253 00254 /*case 9: 00255 DisableTouch(); 00256 screen_glc_2(); 00257 state1=0; 00258 state=6; 00259 nstate=state; 00260 EnableTouch(); 00261 break;*/ 00262 00263 case 9: 00264 DisableTouch(); 00265 screen_bp2(); // bp main screen 00266 bp_countdown(); // countdown for bp 00267 bp(pid); // measuring bp earlier bp() changed to bp(pid) 28/4/2017 00268 state1=0; 00269 // wait(1); 00270 state=6; 00271 nstate=state; 00272 EnableTouch(); 00273 break; 00274 00275 00276 00277 default : 00278 00279 state1=nstate1; 00280 break; 00281 00282 00283 } 00284 00285 00286 00287 00288 00289 } 00290 00291 00292 } 00293 00294 00295 00296 00297 00298 00299
Generated on Tue Jul 12 2022 21:14:18 by 1.7.2