To fix the hang problem
Dependencies: FreescaleIAP SimpleDMA mbed-rtos mbed
Fork of CDMS_CODE by
Diff: COM_POWER_OFF_TX.h
- Revision:
- 144:4c20fcc105ce
- Parent:
- 137:489a93a04d6b
- Child:
- 155:ca7365c03fd7
--- a/COM_POWER_OFF_TX.h Thu Mar 24 04:04:33 2016 +0000 +++ b/COM_POWER_OFF_TX.h Fri Apr 01 19:57:02 2016 +0000 @@ -1,17 +1,50 @@ #define power_on_bae {\ - /*PENDING*/\ + Base_tc *power_on_BAE = new Short_tc;\ + power_on_BAE->next_TC = NULL;\ + PUTshort_or_long(power_on_BAE,SHORT_TC_CODE);\ + PUTcrc_pass(power_on_BAE,0x1);\ + PUTexec_status(power_on_BAE,0);\ + power_on_BAE->TC_string[0] = 0x01;\ + power_on_BAE->TC_string[1] = BAE_APID_SOURCE;\ + power_on_BAE->TC_string[2] = BAE_SERVICE;\ + power_on_BAE->TC_string[3] = BAE_POWER_ON_PID;\ + power_on_BAE->TC_string[4] = 0;\ + power_on_BAE->TC_string[5] = 0;\ + power_on_BAE->TC_string[6] = 0;\ + power_on_BAE->TC_string[7] = 0;\ + power_on_BAE->TC_string[8] = 0;\ + 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;\ + tm_ptr = FCTN_CDMS_RLY_TMTC(power_on_BAE);\ + /*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{\ + /*PENDING: RESET CDMS: MEMORY LEAK FOUND*/\ + break;\ + }\ + }\ } #define resume_bcn {\ Base_tc *beacon_tc = new Short_tc;\ beacon_tc->next_TC = NULL;\ - PUTshort_or_long(beacon_tc,0);\ + PUTshort_or_long(beacon_tc,SHORT_TC_CODE);\ PUTcrc_pass(beacon_tc,0x1);\ PUTexec_status(beacon_tc,0);\ beacon_tc->TC_string[0] = 0x01;\ - beacon_tc->TC_string[1] = 0x41;\ - beacon_tc->TC_string[2] = 0x65;\ - beacon_tc->TC_string[3] = 0x11;\ + beacon_tc->TC_string[1] = BCN_APID_SOURCE;\ + beacon_tc->TC_string[2] = BCN_SERVICE;\ + beacon_tc->TC_string[3] = BCN_ENABLE_PID;\ beacon_tc->TC_string[4] = 0x00;\ beacon_tc->TC_string[5] = 0;\ beacon_tc->TC_string[6] = 0;\ @@ -30,7 +63,9 @@ /*power_on_com_tx_pin = 0;*/\ RX1M.attach(&rx_read, Serial::RxIrq);\ gFLAGS = gFLAGS & (~COM_MNG_TMTC_RUNNING_FLAG);\ - /*PENDING: SWITCH RF RELAY TO BEACON*/\ + RF_SW_CNTRL_BCN = 1;\ + Thread::wait(25);\ + RF_SW_CNTRL_BCN = 0;\ gFLAGS = gFLAGS | RF_SW_STATUS_FLAG;\ if( gFLAGS & COM_AUTO_POWER_OFF_BAE_FLAG ){\ power_on_bae;\