Team Fox / Mbed 2 deprecated BAE_QM_MAR9

Dependencies:   FreescaleIAP mbed-rtos mbed

Fork of workinQM_5thJan_azad by Team Fox

Revision:
32:623747b1cecb
Parent:
31:046685b48b71
diff -r 046685b48b71 -r 623747b1cecb main.cpp
--- a/main.cpp	Fri Jul 01 15:22:18 2016 +0000
+++ b/main.cpp	Sun Jul 03 17:49:37 2016 +0000
@@ -64,6 +64,7 @@
 uint8_t EPS_BTRY_HTR = 0;
 float EPS_BTRY_TMP_LOW;
 float EPS_BTRY_TMP_HIGH;
+float EPS_BTRY_TMP_AVG;
 int EPS_BAT_TEMP_DEFAULT = 20;
 
 
@@ -403,11 +404,12 @@
 void F_EPS()
 {
       float eps_btry_temp;
-      pc.printf("\n\rEntered EPS   %f\n",t_start.read());
+      pc.printf("\n\rEntered EPS   %f\n\r",t_start.read());
       EPS_MAIN_STATUS = 1; // Set EPS main status
       EPS_MAIN_COUNTER++;
       FCTN_BATT_TEMP_SENSOR_MAIN(actual_data.Batt_temp_actual);
-      pc.printf("\n\r Battery temperature %f %f" ,actual_data.Batt_temp_actual[0], actual_data.Batt_temp_actual[1]);
+      pc.printf("Battery temperature %f %f\n\r" ,actual_data.Batt_temp_actual[0], actual_data.Batt_temp_actual[1]);
+      EPS_BTRY_TMP_AVG = ( actual_data.Batt_temp_actual[0] + actual_data.Batt_temp_actual[1] )/2;
       if(abs(actual_data.Batt_temp_actual[0] - actual_data.Batt_temp_actual[1]) > 10)
       {
           EPS_BTRY_TMP_STATUS = 0;          //clear EPS_BTRY_TMP_STATUS
@@ -416,7 +418,7 @@
       else   
       {
           EPS_BTRY_TMP_STATUS = 1;          //set EPS_BTRY_TMP_STATUS
-          eps_btry_temp = ( actual_data.Batt_temp_actual[0] + actual_data.Batt_temp_actual[1] )/2;
+          eps_btry_temp = EPS_BTRY_TMP_AVG;
       }
          
       if(EPS_BTRY_HTR_AUTO == 0)
@@ -446,8 +448,10 @@
         unsigned short statusreg = read(REG_STATUS);
         if( EPS_BATTERY_GAUGE_STATUS == 0 ) reset();
         if( read(REG_STATUS)  & 0x0100 == 0x0100 )     //checking if Reset Indicator bit is set
+        {
+            printf("REG_STATUS = %d\r\n",read(REG_STATUS));    
             FCTN_BATTERYGAUGE_INIT();
-            
+        }    
         int BTG_MAIN_FLAG = FCTN_BATTERYGAUGE_MAIN(actual_data.Batt_gauge_actual, eps_btry_temp);
         if( BTG_MAIN_FLAG == 0 )                      //Data not received
             {
@@ -682,7 +686,7 @@
 uint8_t schedcount=1;
 void T_SC(void const *args)
 {    
-    printf("\n\r in scheduler");
+    printf("\n\r in scheduler\r\n");
    
     if(schedcount == 7)                         //to reset the counter
     {
@@ -891,7 +895,7 @@
     pc.printf("\n\rStarted scheduler %f\n\r",t_start.read()); 
     
 
-    //FCTN_BAE_INIT();
+    FCTN_BAE_INIT();
     while(1);                                                   //required to prevent main from terminating
 }