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 Sep 15 07:38:47 2017 +0000
Parent:
47:3716dd41dba6
Child:
49:3ff80c4bc1be
Commit message:
Merged code with battery monitoring, bluetooth connection timeout and ack timeout

Changed in this revision

bt.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/bt.cpp	Wed Sep 13 11:24:19 2017 +0000
+++ b/bt.cpp	Fri Sep 15 07:38:47 2017 +0000
@@ -54,12 +54,13 @@
                   file_start=0;           
                   count_send=0;  total_samples=0;  
                   file_pointer_position=0;
-    mc.printf("bt_pid = %d\n",get_btpid());
+                 mc.printf("bt_pid = %d\n",get_btpid());
                 if(get_filepid()>get_btpid())                           //check for pid and bluetooth pid by reading from file
                 {
                     send_initial_string(); 
                     blue.printf("\n"); 
-                    file=sd_open_read(get_btpid());
+                    file=sd_open_read(get_btpid());                         // open the file for reading
+                    total_file_size=file_size();                           // determined the file size 
                     state_rx = 1;  
                 }
                          
@@ -73,7 +74,7 @@
                    
        case 2:   total_samples=0; 
                  //file=sd_open_read(get_btpid());  
-                 total_file_size=file_size() ;                           // determined the file size 
+                // total_file_size=file_size() ;                           // determined the file size 
                  sd_read1(bt_file1);                                    // read the sd card file
                  mc.printf("sd file opened to read data in it\n");
                  myBleMsg->bt_msg=bt_file1;                              //copy the contents to the structure
@@ -136,7 +137,7 @@
                   break;        
                
          
-        case 4:   total_file_size_sent=file_size1();
+        case 4:  // total_file_size_sent=file_size1();
                  if(total_file_size_sent==total_file_size)          // if the total file size is same as total file size
                      {                                         // then there is no more data to send in that particular file
                     
@@ -214,7 +215,7 @@
                       { 
                        
                         state_tx=1;
-                       sd_close();
+                        sd_close();
                       }
                    break;                 
  
--- a/main.cpp	Wed Sep 13 11:24:19 2017 +0000
+++ b/main.cpp	Fri Sep 15 07:38:47 2017 +0000
@@ -104,7 +104,7 @@
                                state_r=bt_send(state_t);
                                timer_bt.start();
                                 //gc.printf(" state_t = %d\n", state_t);
-                                 gc.printf(" state_r = %d\n", state_r);   
+                                // gc.printf(" state_r = %d\n", state_r);   
                                 if (state_r==0)                                  // if the state received is zero, then there is no new file to send
                                     {
                                         timer_bt.stop();                           // stop the timer once connected to app
@@ -153,7 +153,7 @@
                             {
                                
                                 state_t=bt_receive(state_r);
-                                 gc.printf(" state_t = %d\n", state_t);
+                               //  gc.printf(" state_t = %d\n", state_t);
                                 // gc.printf(" state_r = %d\n", state_r);
                                 timer_bt.stop();
                                 timer_bt.reset();
@@ -184,7 +184,7 @@
                             main_state=1;
                             state_touch=12;
                             state_t = 1;                                     // state to transmit to bluetooth
-                             state_r = 0;                                     // state to receive from bluetooth
+                            state_r = 0;                                     // state to receive from bluetooth
                             sd_close();                             ///close the opened file which was used for bluetooth
                             timer_bt.stop();
                             timer_bt.reset();