Team Fox / Mbed 2 deprecated RAJANGAM_REVIEW_BAE_CODE

Dependencies:   FreescaleIAP mbed-rtos mbed

Fork of QM_BAE_review_1 by Team Fox

Revision:
32:623747b1cecb
Parent:
30:22b338b027de
--- a/EPS.cpp	Fri Jul 01 15:22:18 2016 +0000
+++ b/EPS.cpp	Sun Jul 03 17:49:37 2016 +0000
@@ -102,13 +102,15 @@
     // FLAG();
     FCTN_BATTERYGAUGE_INIT();
     EN3V3A = 1;                             //enable dc dc converter A  
+    
     char value=alertFlags(); // initialization part of battery gauge
     unsigned short value_u= (short int )value;
-    value_u &=0x0001;                     
-    if(value_u ==0x0001)                       // battery gauge not initialised
+    //value_u &=0x0001;                     
+    if(value_u & 0x0001 == 0x0001)                       // battery gauge not initialised
     {
         actual_data.power_mode = 1;
         EPS_BATTERY_GAUGE_STATUS = 0;               //clear EPS_BATTERY_GAUGE_STATUS
+        printf(" init BTG fail - %d\n\r", value_u);
     }
     else
     {
@@ -116,8 +118,11 @@
         actual_data.Batt_voltage_actual = Batt_voltage.read()*3.3; //1 corresponds to 3.3 scaling factor
         FCTN_EPS_POWERMODE(actual_data.Batt_gauge_actual[1]);
         EPS_BATTERY_GAUGE_STATUS = 1;               //set EPS_BATTERY_GAUGE_STATUS
+        printf("init BTG success - %d\n\r", value_u);
     }
-   
+    
+    //if( read(REG_VERSION) == 
+    printf("REG_VERSION = %d\r\n",read(REG_VERSION));
     FCTN_BATTTEMP_INIT();
     EPS_BATTERY_GAUGE_STATUS = 1;
     
@@ -286,7 +291,7 @@
             s1=SelectLineb1=SelectLinea2;
             s2=SelectLineb2=SelectLinea2;
             s3=SelectLineb3=SelectLinea3;
-            printf("\n\r  %d %d %d %d", s0,s1,s2,s3);
+//            printf("\n\r  %d %d %d %d", s0,s1,s2,s3);
 
     }
       for(Iteration=0; Iteration<16; Iteration++)
@@ -528,7 +533,9 @@
         vAlertMinMaxThreshold();//set min, max value of Valrt register
         vResetThresholdSet();//set threshold voltage for reset
         vResetAlertEnabled(true);//enable alert on reset for V < Vreset
-        write(REG_STATUS, read(REG_STATUS) & 0xFEFF);   //Clearing Reset Indicator bit
+        int ack = write(REG_STATUS, read(REG_STATUS) & 0xFEFF);   //Clearing Reset Indicator bit
+        if( ack == 0 ) printf("BTG init success\n\r");
+        else printf("BTG init fail ack = %d\n\r", ack);
 }
 
 int FCTN_BATTERYGAUGE_MAIN(float Battery_parameters[4], float temp)
@@ -543,7 +550,7 @@
         Battery_parameters[2]=crate();
                
         printf("\nVcell=%f",vcell());       //remove this for final code
-        printf("\nSOC=%f",soc());           //remove this for final code
+        printf("\nSOC=%f",Battery_parameters[1]);           //remove this for final code
         printf("\nC_rate=%f",crate());      //remove this for final code
 
         if (alerting()== true)       //alert is on
@@ -810,7 +817,7 @@
        
         ack = m_I2C.read(m_ADDR, buff, 2);
             
-        printf("\n\r acknow %d", ack);
+        printf("\n\r SOC: acknow %d\n\r", ack);
  
         //Return SOC in percent
         if(ack == 0)