Team Fox / Mbed 2 deprecated BAE_QM_MAR9

Dependencies:   FreescaleIAP mbed-rtos mbed

Fork of workinQM_5thJan_azad by Team Fox

Revision:
66:a5d2b8dc6b9e
Parent:
65:d1b12729fcdc
Child:
67:c0dd13285d80
diff -r d1b12729fcdc -r a5d2b8dc6b9e main.cpp
--- a/main.cpp	Thu Nov 24 09:45:08 2016 +0000
+++ b/main.cpp	Sun Dec 04 07:58:20 2016 +0000
@@ -1,5 +1,3 @@
-
-
 #include "mbed.h"
 #include "rtos.h"
 #include "pin_config.h"
@@ -18,8 +16,6 @@
 #define baby2 1
 #define SBC 1
 
-
-
 Timer timer_FCTN_ACS_GENPWM_MAIN;
 Timer timer_FCTN_ACS_CNTRLALGO;
 Timer timer_FCTN_BAE_INIT;
@@ -46,7 +42,6 @@
 extern Timer timer_soc;
 extern Timer timer_FCTN_BATTERYGAUGE_INIT;
 
-
 Timer timer_F_BCN;
 Timer timer_FCTN_BCN_TX_MAIN;
 extern Timer timer_Init_BEACON_HW;
@@ -56,8 +51,6 @@
 extern Timer timer_Set_BCN_TX_STATUS_SUCCESS;
 extern Timer timer_Set_BCN_TX_STATUS_FAILURE;
 
-
-
 #define DISABLE_WDOG 0;
 
 void kick_WDOG()
@@ -78,7 +71,6 @@
 //**********************************************GLOBAL RTOS TIMER*********************************************************//
 RtosTimer *BAE_STANDBY_STATUS_TIMER;
 
-
 //bcn heater rtostimers=============================================================================
 RtosTimer *HTR_OFF=NULL;
 RtosTimer *HTR_CYCLE=NULL;
@@ -166,12 +158,12 @@
         LONG_HK_data[0][i] = tc[i];    
 }
 
-uint8_t BAE_STANDBY=0x00;// as Bcn Acs Eps last three bits BAE order , 1 refer to switch off.
+uint8_t BAE_STANDBY=0x07;// as Bcn Acs Eps last three bits BAE order ,  refer to switch off.//old convection now *****0***** means off
 
 void BAE_STANDBY_STATUS_RESET(const void* arg)
 {
     printf("\n\rBAE standby reset to 0x00");
-    BAE_STANDBY=0x00;
+    BAE_STANDBY=0x07;
 }
 
 
@@ -265,7 +257,7 @@
 //uint8_t BAE_HK_data[134];  now known as LONG_HK_data[1][i];  
 uint8_t BAE_RESET_COUNTER;// INITIALIZATION or do you want to initialize evertime the main is reset? or is it same     
 uint16_t BAE_I2C_COUNTER = 0;//change/apply
-//uint8_t BAE_STANDBY=0x00;// as Bcn Acs Eps last three bits BAE order , 1 refer to switch off.
+//uint8_t BAE_STANDBY=0x00;// as Bcn Acs Eps last three bits BAE order , 1old convection refer to switch off. chnaged now 0 means offfffffffff FU==
 
 //BCN
 //uint16_t BCN_TX_MAIN_COUNTER = 0;
@@ -396,7 +388,7 @@
 
 DigitalOut CDMS_OC_ENA(PIN70,1);
 
-DigitalOut BCN_SW(PIN65,1);               //IN TEMPORARY SBC
+DigitalOut BCN_SW(PIN64,1); // PIN changed to 64 (previous 65 )              //IN TEMPORARY SBC
 //DigitalOut BCN_SW(PIN14,1);      //Beacon switch  //IN QM SBC, TO BE CHANGED
 
 //================================================================================
@@ -953,6 +945,7 @@
         else if( slave.receive() == 1)                                     // slave writes to master
         {
             BAE_I2C_COUNTER++;                                                      //////////edited
+            pc.printf("\n\r writing....");// changed
             if(data_send_flag == 'h') //to be renamed as BAE_I2C_STATUS
             {
                 irpt_2_mstr =1;   
@@ -1212,8 +1205,9 @@
         schedcount = 1;
     if(schedcount%1==0)
         {
-            if( BAE_STANDBY!=0x02 && BAE_STANDBY!=0x03 && BAE_STANDBY!=0x06 && BAE_STANDBY!=0x07)
+            if( BAE_STANDBY==0x02 || BAE_STANDBY==0x03 || BAE_STANDBY==0x06 || BAE_STANDBY==0x07)
                 {
+                    pc.printf("\n reahed here working till stage one acs");
                     pc.printf("\nSTATE IS !!!!!! = %x !!\n",ACS_STATE);
                     timer_F_ACS.reset();
                     timer_F_ACS.start();
@@ -1233,8 +1227,9 @@
         }
     if(schedcount%4==0)
         {   
-            if( BAE_STANDBY!=0x01 && BAE_STANDBY!=0x03 && BAE_STANDBY!=0x05 && BAE_STANDBY!=0x07)
+            if( BAE_STANDBY==0x01 || BAE_STANDBY==0x03 || BAE_STANDBY==0x05 || BAE_STANDBY==0x07)
                 {
+                    pc.printf("\n reahed here working till stage one eps");
                     //time_wdog = 1;
                     timer_F_ESP.reset();
                     timer_F_ESP.start();
@@ -1257,8 +1252,10 @@
         }
     if(schedcount%6==0)
         {
-            if(BAE_STANDBY!=0x04 && BAE_STANDBY!=0x05 && BAE_STANDBY!=0x06 && BAE_STANDBY!=0x07)
-                {    //  time_wdog = 0;
+            if(BAE_STANDBY==0x04 || BAE_STANDBY==0x05 || BAE_STANDBY==0x06 || BAE_STANDBY==0x07)
+                {    
+                    pc.printf("\n reahed here working till stage one bcn");
+                    //  time_wdog = 0;
                     timer_F_BCN.reset();
                     timer_F_BCN.start();
                     F_BCN();
@@ -1488,7 +1485,7 @@
     irpt_2_mstr = 0;
     
     ptr_t_i2c = new Thread(T_TC);
-    ptr_t_i2c->set_priority(osPriorityRealtime);
+    ptr_t_i2c->set_priority(osPriorityHigh);////osPriorityRealtime
         
     irpt_4m_mstr.enable_irq();
     irpt_4m_mstr.rise(&FCTN_I2C_ISR);