CDMS code for testing sbc
Dependencies: FreescaleIAP SimpleDMA mbed-rtos mbed
Fork of CDMS_CODE by
Diff: ThreadsAndFunctions.h
- Revision:
- 135:522f7d73d04f
- Parent:
- 134:4694fc291ce1
- Child:
- 144:4c20fcc105ce
diff -r 4694fc291ce1 -r 522f7d73d04f ThreadsAndFunctions.h --- a/ThreadsAndFunctions.h Tue Mar 01 17:42:30 2016 +0000 +++ b/ThreadsAndFunctions.h Wed Mar 02 17:17:45 2016 +0000 @@ -129,17 +129,20 @@ gPC.printf("valid TC rx: %u\r\n", gTOTAL_VALID_TC); if( gTOTAL_VALID_TC < COM_MAX_TC_LIMIT ){ // CHECK WEATHER TC LIST HAS MISSING TC OR WEATHER LAST FRAME BIT IS HIGH IN THE LAST PSC-TC - /*gPC.puts("checking for tc list complete\r\n");*/ + if (DEBUG) + gPC.puts("checking for tc list complete\r\n"); uint8_t tempContinue = 0xFF; continueToExecute(tempContinue); if(tempContinue == 0x00){ - /*gPC.puts("tc list is complete\r\n");*/ + if (DEBUG) + gPC.puts("tc list is complete\r\n"); // CHECK WEATHER GS VERIFICATION CODE MATCHES uint8_t tempGSver = 0x00; GScodeVerification(tempGSver); /*PENDING: INCLUDE GS VERIFICATION CODE*/ if( tempGSver == 0xFF ){ - /*gPC.puts("GS code match !!\r\n");*/ + if (DEBUG) + gPC.puts("GS code match !!\r\n"); gFLAGS = gFLAGS | COM_SESSION_VALIDITY; COM_POWER_ON_TX; // PENDING: PA HOT HANDLED IN EXECUTE_XXX FUNCTIONS @@ -148,11 +151,13 @@ if( tempPAHot == 0xFF ){ gFLAGS = gFLAGS & ~(COM_PA_HOT_FLAG); gCOM_PA_COOLING_TIMEOUT.detach(); - gPC.puts("EXECUTING TELECOMMANDS\r\n"); -// DEBUF_PRINT("EXECUTING TELECOMMANDS\r\n"); + if (DEBUG) + gPC.puts("EXECUTING TELECOMMANDS\r\n"); +// DEBUF_PRINT("EXECUTING TELECOMMANDS\r\n"); EXECUTE_OBOSC_ONLY; EXECUTE_TC; - /*gPC.puts("COMPLETED EXECUTION\r\n");*/ + if (DEBUG) + gPC.puts("COMPLETED EXECUTION\r\n"); } else{ gFLAGS = gFLAGS | COM_PA_HOT_FLAG; @@ -163,7 +168,8 @@ } } else{ - /*gPC.puts("GS code mismatch !!\r\n");*/ + if(DEBUG) + gPC.puts("GS code mismatch !!\r\n"); RX1M.attach(&rx_read, Serial::RxIrq); reset_all; gFLAGS = gFLAGS & (~COM_SESSION_VALIDITY); @@ -175,16 +181,22 @@ } } else{ - //gPC.puts("tc list is not complete\r\n"); + if (DEBUG) + gPC.puts("tc list is not complete\r\n"); if(tempContinue & 0x01){ - //gPC.puts("last packet bit not found\r\n"); + if (DEBUG) + gPC.puts("last packet bit not found\r\n"); } if( tempContinue & 0x02 ){ - //gPC.puts("missing psc found\r\n"); + if (DEBUG) + gPC.puts("missing psc found\r\n"); } - //gPC.printf("crc fail tc = %u\r\n", gTOTAL_CRC_FAIL_TC); - //gPC.printf("incorrect size tc = %u\r\n", gTOTAL_INCORRECT_SIZE_TC); - //gPC.printf("repeated psc = %u\r\n", gTOTAL_REPEATED_TC); + if (DEBUG){ + gPC.printf("crc fail tc = %u\r\n", gTOTAL_CRC_FAIL_TC); + gPC.printf("incorrect size tc = %u\r\n", gTOTAL_INCORRECT_SIZE_TC); + gPC.printf("repeated psc = %u\r\n", gTOTAL_REPEATED_TC); + gPC.puts("\r\n"); + } Base_tc *test_tc = gHEAD_NODE_TCL; while( test_tc != NULL ){ int length = 0; @@ -195,9 +207,13 @@ length = TC_LONG_SIZE; } for(int i = 0 ; i < length ; ++i ){ - //gPC.printf("%x ", test_tc->TC_string[i]); + int x = 128; + for( int j = 7 ; j >= 0 ; --j ){ + gPC.printf("%d", (test_tc->TC_string[i] & x)>>j); + x = x/2; + } } - //gPC.puts("\r\n"); + gPC.puts("\r\n"); test_tc = test_tc->next_TC; } //gPC.puts("\r\n"); @@ -216,7 +232,8 @@ } } else{ - /*gPC.puts("No valid TC received\r\n");*/ + if (DEBUG) + gPC.puts("No valid TC received\r\n"); RX1M.attach(&rx_read, Serial::RxIrq); gFLAGS = gFLAGS & (~COM_MNG_TMTC_RUNNING_FLAG); reset_all; @@ -227,7 +244,8 @@ } } else if( gFLAGS & COM_PA_HOT_FLAG ){ - /*gPC.puts("checking for PA hot in main\r\n");*/ + if (DEBUG) + gPC.puts("checking for PA hot in main\r\n"); if( gFLAGS & COM_RX_FLAG ){ uint8_t tempPA = 0xFF; isPAhot(tempPA); @@ -258,7 +276,8 @@ } } else if( gFLAGS & COM_SESSION_TIMEOUT_FLAG ){ - /*gPC.puts("session timeout: resetting in main\r\n");*/ + if (DEBUG) + gPC.puts("session timeout: resetting in main\r\n"); COM_POWER_OFF_TX; /*PENDING : ENABLE THREADS*/ gPAY_SPI.bulkRead_start(); @@ -268,7 +287,8 @@ reset_all; } else{ - /*gPC.puts("INVALID SIGNAL RECEIVED IN MAIN\r\n");*/ + if (DEBUG) + gPC.puts("INVALID SIGNAL RECEIVED IN MAIN\r\n"); // SOME INVALID SIGNAL RECEIVED COM_POWER_OFF_TX; reset_all; @@ -293,7 +313,7 @@ gPAY_SPI.bulkRead_start(); while(true){ - gPC.puts("entering sci\r\n"); + gPC.puts("entering science thread\r\n"); gSCIENCE_THREAD->signal_wait(SCIENCE_SIGNAL); gPC.puts("sig_set\r\n"); srp(gPAYLOAD_BUFFER);