To fix the hang problem
Dependencies: FreescaleIAP SimpleDMA mbed-rtos mbed
Fork of CDMS_CODE by
Diff: COM_POWER_OFF_TX.h
- Revision:
- 212:3d13a06bcd3a
- Parent:
- 211:77bee0cbebfe
--- a/COM_POWER_OFF_TX.h Sat Jun 18 09:07:28 2016 +0000 +++ b/COM_POWER_OFF_TX.h Sun Jul 03 05:37:25 2016 +0000 @@ -16,8 +16,16 @@ uint16_t crc16 = crc16_gen(RESET_tc->TC_string, 9);\ RESET_tc->TC_string[9] = (crc16 & 0xFF00)>>8;\ RESET_tc->TC_string[10] = (crc16 & 0x00FF);\ - FCTN_CDMS_RLY_TMTC(RESET_tc);\ + Base_tm *tm_ptr = NULL;\ + tm_ptr = FCTN_CDMS_RLY_TMTC(RESET_tc);\ delete RESET_tc;\ + /*DELETE THE TM AFTER USE*/\ + Base_tm *del_tm = tm_ptr;\ + while( del_tm != NULL ){\ + Base_tm *temp = del_tm->next_TM;\ + delete del_tm;\ + del_tm = temp;\ + }\ } #define power_on_bae {\ @@ -38,7 +46,7 @@ uint16_t crc16 = crc16_gen(power_on_BAE->TC_string, 9);\ power_on_BAE->TC_string[9] = (crc16 & 0xFF00)>>8;\ power_on_BAE->TC_string[10] = (crc16 & 0x00FF);\ - Base_tm *tm_ptr = new Short_tm;\ + Base_tm *tm_ptr = NULL;\ tm_ptr = FCTN_CDMS_RLY_TMTC(power_on_BAE);\ delete power_on_BAE;\ /*DELETE THE TM AFTER USE*/\ @@ -59,9 +67,9 @@ } #define resume_bcn {\ - Base_tc *beacon_tc = new Short_tc;\ + Base_tc *beacon_tc = new Long_tc;\ beacon_tc->next_TC = NULL;\ - PUTshort_or_long(beacon_tc,SHORT_TC_CODE);\ + PUTshort_or_long(beacon_tc,LONG_TC_CODE);\ PUTcrc_pass(beacon_tc,0x1);\ PUTexec_status(beacon_tc,0);\ beacon_tc->TC_string[0] = 0x01;\ @@ -76,9 +84,27 @@ uint16_t crc16 = crc16_gen(beacon_tc->TC_string, 9);\ beacon_tc->TC_string[9] = (crc16 & 0xFF00)>>8;\ beacon_tc->TC_string[10] = (crc16 & 0x00FF);\ - Base_tm *tm_ptr = new Short_tm;\ + for(int i = 11; i < 135; i++){\ + beacon_tc->TC_string[i] = 0;\ + }\ + Base_tm *tm_ptr = NULL;\ tm_ptr = FCTN_CDMS_RLY_TMTC(beacon_tc);\ delete beacon_tc;\ + /*DELETE THE TM AFTER USE*/\ + Base_tm *del_tm = tm_ptr;\ + int overCount = 0;\ + while( del_tm != NULL ){\ + if( (overCount < TM_OVERFLOW_CONSTANT) ){\ + Base_tm *temp = del_tm->next_TM;\ + delete del_tm;\ + del_tm = temp;\ + ++overCount;\ + }\ + else{\ + RESET_CDMS;\ + break;\ + }\ + }\ } #define COM_POWER_OFF_TX {\ @@ -102,6 +128,7 @@ }\ }\ gFLAGS = gFLAGS & (~COM_PA_HOT_FLAG);\ + gFLAGS = gFLAGS & (~COM_PA_OC_FLAG);\ gCOM_PA_COOLING_TIMEOUT.detach();\ gFLAGS = gFLAGS & (~COM_TX_FLAG);\ gFLAGS = gFLAGS & (~COM_SESSION_TIMEOUT_FLAG);\