pl ack in tmtc

Dependencies:   FreescaleIAP SimpleDMA mbed-rtos mbed

Fork of COM_MNG_TMTC_SIMPLE_pl123 by shubham c

Revision:
135:522f7d73d04f
Parent:
134:4694fc291ce1
--- a/COM_MNG_TMTC.h	Tue Mar 01 17:42:30 2016 +0000
+++ b/COM_MNG_TMTC.h	Wed Mar 02 17:17:45 2016 +0000
@@ -829,6 +829,8 @@
 // CDMS TEAM CODE END
 // EXECUTE OBOSC
 #define execute_obosc_core(tc_ptr, tm_ptr, reset_flag) {\
+    if (DEBUG)\
+        gPC.puts("Inside execute_obosc_core\r\n");\
     uint8_t service_subtype = (tc_ptr->TC_string[2]) & 0x0F;\
     uint8_t temp8 = 0x00;\
     Base_tc *modify_this = gHEAD_NODE_TCL;\
@@ -932,7 +934,8 @@
         /*CHANGE THE ACK CODE TO INVALID TC*/\
         ackl234new->TM_string[2] = 0xA2;\
     }\
-    /*gPC.puts("completed obosc\r\n");*/\
+    if (DEBUG)\
+        gPC.puts("completed obosc\r\n");\
 }
 
 /*tm_ptr is the next_TM of a linked list, and should have the value NULL, i.e. tm_ptr should be the next_TM pointer of thte last node */
@@ -940,6 +943,8 @@
 
 #define EXECUTE_OBOSC_ONLY {\
     int reset_flag = 0;\
+    if (DEBUG)\
+        gPC.puts("iNSIDE EXECUTE_OBOSC_ONLY\r\n");\
     for(uint8_t execute_psc = PSC_START_VALUE ; execute_psc < gTOTAL_VALID_TC ; ++execute_psc){\
         Base_tc* current_TC = gHEAD_NODE_TCL;\
         int overCount = 0;\
@@ -1029,6 +1034,8 @@
 
 #define EXECUTE_TC {\
     gMASTER_STATE = TCL_STATE_EXECUTING;\
+    if (DEBUG)\
+        gPC.puts("iNSIDE EXECUTE_TC\r\n");\
     /*gPC.printf("%u\r\n", gTOTAL_VALID_TC);*/\
     for(uint8_t execute_psc = PSC_START_VALUE ; execute_psc < gTOTAL_VALID_TC ; ++execute_psc ){\
         if (DEBUG)\
@@ -1092,7 +1099,8 @@
                         uint8_t temp81 = 0x00;\
                         isit_sdcard(current_TC, temp81);\
                         if( temp81 == 0x00 ){\
-                            /*gPC.printf("non sd card at %u\r\n", execute_psc);*/\
+                            if (DEBUG)\
+                                gPC.printf("non sd card at %u\r\n", execute_psc);\
                             /*EXECUTION OF NON SD-CARD (BOTH OBOSC and CDMS functions)*/\
                             Base_tm *tm_ptr_head = NULL;\
                             get_call_sign(tm_ptr_head);\
@@ -1224,7 +1232,8 @@
                             }\
                         }\
                         else{\
-                            /*gPC.printf("sd card at %u\r\n", execute_psc);*/\
+                            if (DEBUG)\
+                                gPC.printf("sd card at %u\r\n", execute_psc);\
                             /*EXECUTION OF SD-CARD DATA SENDING (OBSRS)*/\
                             Base_tm *tm_ptr_head = NULL;\
                             get_call_sign(tm_ptr_head);\
@@ -1348,7 +1357,8 @@
             break;\
         }\
         else if( gMASTER_STATE == TCL_STATE_ABORTED ){\
-            /*gPC.puts("ABORTING DUE TO ABORT ON NACK\r\n");*/\
+            if (DEBUG)\
+                gPC.puts("ABORTING DUE TO ABORT ON NACK\r\n");\
             /*EXITED DUE TO ABORT ON NACK:*/\
             /*PENDING : POWER OFF COM TX*/\
             RX1M.attach(&rx_read, Serial::RxIrq);\
@@ -1363,10 +1373,12 @@
             gFLAGS = gFLAGS & (~COM_MNG_TMTC_RUNNING_FLAG);\
             break;\
         }\
-        /*gPC.printf("successflly executed %u tc\r\n", execute_psc);*/\
+        if (DEBUG)\
+            gPC.printf("successflly executed %u tc\r\n", execute_psc);\
     }\
     if( (gMASTER_STATE == TCL_STATE_COMPLETED) || (gFLAGS & COM_SESSION_TIMEOUT_FLAG) ){\
-        /*gPC.printf("completed or session timed out: %x\r\n", gMASTER_STATE);*/\
+        if (DEBUG)\
+            gPC.printf("completed or session timed out: %x\r\n", gMASTER_STATE);\
         /*COMPLETED EXECUTION OF TC*/\
         gMASTER_STATE = TCL_STATE_COMPLETED;\
         COM_POWER_OFF_TX;\