created separate function for hex to char

Dependencies:   SDFileSystem ds3231 eeprom_Nikita mbed testUniGraphic_150217

Fork of SS_SensePOC2P0_11Dec2017_USERPID by rashmi v

Revision:
47:3716dd41dba6
Parent:
46:162ed3f051b2
Child:
48:f90edb35a20e
--- a/main.cpp	Wed Sep 13 06:06:41 2017 +0000
+++ b/main.cpp	Wed Sep 13 11:24:19 2017 +0000
@@ -42,13 +42,14 @@
     static uint8_t main_state=1;
     static uint8_t state_display = 0;
     static uint8_t state_touch = 1;
-    static uint8_t state_t = 1;                                     // state to transmit to bluetooth
-    static uint8_t state_r = 0;                                     // state to receive from bluetooth
+    uint8_t state_t = 1;                                     // state to transmit to bluetooth
+    uint8_t state_r = 0;                                     // state to receive from bluetooth
 
   
   
     DisableTouch();
     gc.baud(115200);
+    blue1.baud(115200);
     init_screen();                                                  //initialize lcd
     pid = get_filepid();
     screen_main();                                                  // display of main screen 
@@ -102,7 +103,8 @@
                                BT_connection() ;                                // displaying connection on bluetooth 
                                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);   
                                 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
@@ -136,6 +138,7 @@
                             EnableTouch();
                             main_state=1;
                             state_touch=12;
+                            sd_close();  
                             timer_bt.stop();
                             timer_bt.reset();
                         }
@@ -150,6 +153,8 @@
                             {
                                
                                 state_t=bt_receive(state_r);
+                                 gc.printf(" state_t = %d\n", state_t);
+                                // gc.printf(" state_r = %d\n", state_r);
                                 timer_bt.stop();
                                 timer_bt.reset();
                                 if(state_t ==0)           // if state_t is zero, there is no other file to send
@@ -178,6 +183,8 @@
                             EnableTouch();
                             main_state=1;
                             state_touch=12;
+                            state_t = 1;                                     // state to transmit to 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();