To fix the hang problem

Dependencies:   FreescaleIAP SimpleDMA mbed-rtos mbed

Fork of CDMS_CODE by shubham c

Revision:
289:9bd62b69874c
Parent:
266:ae588e75cfa4
Child:
295:699801854b71
--- a/CDMS_PL.h	Fri Aug 05 17:13:23 2016 +0000
+++ b/CDMS_PL.h	Sat Aug 06 06:34:38 2016 +0000
@@ -269,7 +269,7 @@
     if(t!=0)
     {
         gPC.printf("\n\rTesting OC protection");
-        PL_BEE_SW_STATUS = 2;   //OC protection
+        PL_STATUS = 2;   //OC protection
     }
 }
 void test2(uint8_t t)
@@ -278,7 +278,7 @@
     if(t!=0)    
     {
         gPC.printf("\n\rTesting Deviced Disabled case");
-        PL_BEE_SW_STATUS = 3;   //Device DISABLED 
+        PL_STATUS = 3;   //Device DISABLED 
     }
 }
 void test3(uint8_t t)
@@ -299,6 +299,8 @@
 }*/
 void FCTN_CDMS_PL_MAIN(void const *args)
 {
+    if(EN_PL == 0x00)
+    return;
     uint8_t temp[3];
     pl_main_flag|=PL_MAIN_STATUS;                       //Setting PL_MAIN_STATUS
     PL_MAIN_COUNTER++;                                  
@@ -308,7 +310,7 @@
     temp[2] = (PL_PREV_STATE & STATE_SCIENCE)>>2;
     //test2(1);
 
-    if(PL_BEE_SW_STATUS==2 || PL_BEE_SW_STATUS==3)
+    if(PL_STATUS==2 || PL_STATUS==3)
     {
         gPC.printf("\n\rDevice Disabled or OC Fault");
         pl_main_flag  = pl_main_flag & (~PL_DISABLED);
@@ -420,14 +422,14 @@
         case STATE_OFF: 
         {
             gPC.printf("\n\rEntered PL_OFF case");
-            if(PL_BEE_SW_STATUS!=0) 
+            if(PL_STATUS!=0) 
             {
                 gPC.printf("\n\rCommanding PL_BEE to go to Standby State");
                 Base_tm *tm_ptr_standby;
                 SET_PL_BEE_STANDBY(tm_ptr_standby);                             //No ack needed now
                 gPC.printf("\n\rPowering OFF PL_BEE");
                 SET_PL_BEE_OFF;
-                PL_BEE_SW_STATUS=0;    
+                PL_STATUS=0;    
             }           
             pl_main_flag  = pl_main_flag & (~PL_DISABLED);
             pl_main_flag |= PL_OFF;    
@@ -441,11 +443,11 @@
         case STATE_STANDBY: 
         {            
             gPC.printf("\n\rEntered PL_STANDBY case");
-            if(PL_BEE_SW_STATUS==0) 
+            if(PL_STATUS==0) 
             {
                 gPC.printf("\n\rPowering on PL_BEE");
                 SET_PL_BEE_ON;
-                PL_BEE_SW_STATUS=1;
+                PL_STATUS=1;
             }
             gPC.printf("\n\rCommanding PL_BEE to go to Standby State");  
             Base_tm *tm_ptr_standby;
@@ -466,11 +468,11 @@
             gPC.printf("\n\rEntered PL_HIBERNATE case");
             if(POWER_LEVEL==2 || POWER_LEVEL==3 || POWER_LEVEL==0)
             {                
-                if(PL_BEE_SW_STATUS==0) 
+                if(PL_STATUS==0) 
                 {
                     gPC.printf("Powering on PL_BEE\r\n");                    
                     SET_PL_BEE_ON;
-                    PL_BEE_SW_STATUS=1;
+                    PL_STATUS=1;
                 }
                 gPC.printf("\n\rCommanding PL_BEE to go to Hibernate State");  
                 Base_tm *tm_ptr_hibernate;
@@ -484,11 +486,11 @@
             else 
             {
                 pl_main_flag |= PL_LOW_POWER;
-                if(PL_BEE_SW_STATUS==0) 
+                if(PL_STATUS==0) 
                 {
                     gPC.printf("\n\rPowering on PL_BEE");
                     SET_PL_BEE_ON;
-                    PL_BEE_SW_STATUS=1;
+                    PL_STATUS=1;
                 }
                 gPC.printf("\n\rCommanding PL_BEE to go to Standby State");
                 Base_tm *tm_ptr_standby;
@@ -516,11 +518,11 @@
             if(POWER_LEVEL==3 || POWER_LEVEL==0)                            //POWER_LEVEL = 0 = NA
             {
                 gPC.printf("\n\rPOWER_LEVEL = 3 or NA");
-                if(PL_BEE_SW_STATUS==0)
+                if(PL_STATUS==0)
                 {
                     gPC.printf("\n\rPowering on PL_BEE");
                     SET_PL_BEE_ON;
-                    PL_BEE_SW_STATUS=1;
+                    PL_STATUS=1;
                 }
                 gPC.printf("\n\rCommanding PL_BEE to go to Science State");  
                 Base_tm *tm_ptr_science;
@@ -541,11 +543,11 @@
                 pl_main_flag |= PL_LOW_POWER;
                 if(POWER_LEVEL==2 || POWER_LEVEL==3 || POWER_LEVEL==0)
                 {                
-                    if(PL_BEE_SW_STATUS==0) 
+                    if(PL_STATUS==0) 
                     {
                         gPC.printf("\n\rPowering on PL_BEE");
                         SET_PL_BEE_ON;
-                        PL_BEE_SW_STATUS=1;
+                        PL_STATUS=1;
                     }
                     gPC.printf("\n\rCommanding PL_BEE to go to Hibernate State");  
                     Base_tm *tm_ptr_hibernate;
@@ -559,11 +561,11 @@
                 else 
                 {
                     pl_main_flag |= PL_LOW_POWER;
-                    if(PL_BEE_SW_STATUS==0) 
+                    if(PL_STATUS==0) 
                     {
                         gPC.printf("\n\rPowering on PL_BEE");
                         SET_PL_BEE_ON;
-                        PL_BEE_SW_STATUS=1;
+                        PL_STATUS=1;
                     }
                     gPC.printf("\n\rCommanding PL_BEE to go to Standby State");  
                     Base_tm *tm_ptr_standby;