To fix the hang problem
Dependencies: FreescaleIAP SimpleDMA mbed-rtos mbed
Fork of CDMS_CODE by
COM_POWER_ON_TX.h
- Committer:
- aniruddhv
- Date:
- 2016-01-05
- Revision:
- 22:5febef18443d
- Parent:
- 15:1c1ca992b43b
- Child:
- 23:c89376564196
File content as of revision 22:5febef18443d:
#define COM_POWER_ON_TX {\ /*gPC.puts("Inside COM_POWER_ON_TX\r\n");*/\ if( !(gFLAGS & COM_TX_FLAG) ){\ gFLAGS = gFLAGS | COM_TX_FLAG;\ /*WARNING: INFINITE WHILE LOOP POSSIBLE: if standby ack received and bcn tx main status = 0*/\ bool retryFlag = true;\ while( retryFlag == true ){\ uint8_t standbyAck = 0xFF;\ /*PENDING: SET BEACON TO STANDBY*/\ if( standbyAck == 0xFF ){\ /*ACK RECCEIVED*/\ /*PENDING: BEACON TX MAIN STATUS*/\ if( true ){\ retryFlag = false;\ /*PENDING: SWITCH RELAY TO COM_TX*/\ /*PENDING: RF_SW_STATUS = RF_COM_TX*/\ }\ else{\ gCOM_MNG_TMTC_THREAD->wait(5000);\ }\ }\ else{\ /*PENDING: RESET BAE*/\ uint8_t standbyAck2 = 0x00;\ /*PENDING: SET BEACON TO STANDBY*/\ if( standbyAck2 == 0xFF ){\ /*PENDING: BEACON TX MAIN STAUTS*/\ if( true ){\ retryFlag = false;\ /*PENDING: SWITCH RF RELAY TO COM TX*/\ /*PENDING: RF_SW_STATUS = RF_COM_TX*/\ }\ }\ else{\ retryFlag = false;\ /*PENDING: POWER OFF BEACON*/\ /*PENDING: CLEAR BAE SW_EN*/\ /*PENDING: SWITCH RF RELAY TO COM TX*/\ /*PENDING: RF_SW_STATUS = RF_COM_TX*/\ }\ }\ }\ }\ /*PENDING: POWER ON COM_TX*/\ uint8_t adfConfigPass = 0xFF;\ for( int i = 0 ; i < COM_TX_CONFIG_LIMIT ; ++i ){\ /*PENDING: CONFIGURE ADF*/\ if( adfConfigPass == 0xFF ){\ break;\ }\ }\ if( adfConfigPass == 0xFF ){\ /*adf successfully configured*/\ /*CALL SIGN*/\ Base_tm *power_on_tm = NULL;\ Base_tm *power_on_tm_head = NULL;\ get_call_sign( power_on_tm_head );\ power_on_tm = power_on_tm_head;\ /*ACK L1*/\ get_ack_l1(power_on_tm->next_TM);\ int overFlowCountADF = 0;\ while( power_on_tm->next_TM != NULL ){\ if( overFlowCountADF < TM_OVERFLOW_CONSTANT ){\ power_on_tm = power_on_tm->next_TM;\ ++overFlowCountADF;\ }\ else{\ /*PENDING: RESET CDMS*/\ break;\ }\ }\ get_tc_list(power_on_tm->next_TM, 0x00);\ power_on_tm = power_on_tm_head;\ while(power_on_tm != NULL){\ int length = TM_SHORT_SIZE;\ if( GETshort_or_long_tm(power_on_tm->fields) == SHORT_TM_CODE ){\ length = TM_SHORT_SIZE;\ }\ else{\ length = TM_LONG_SIZE;\ }\ gPC.puts("Printing Call Sign, ACK_L1, TC_LIST inside COM_POWER_ON\r\n");\ for(int i = 0 ; i < length ; ++i){\ gPC.putc(power_on_tm->TM_string[i]);\ }\ power_on_tm = power_on_tm->next_TM;\ }\ /*PENDING: TRANSMIT ABOVE TM*/\ /*deleting the telemetry*/\ power_on_tm = power_on_tm_head;\ overFlowCountADF = 0;\ while( power_on_tm != NULL ){\ if( overFlowCountADF < TM_OVERFLOW_CONSTANT ){\ Base_tm *temp = power_on_tm->next_TM;\ delete power_on_tm;\ power_on_tm = temp;\ ++overFlowCountADF;\ }\ else{\ /*PENDING: RESET CDMS*/\ break;\ }\ }\ }\ else{\ /*PENDING: COM_POWER OFF TX*/\ /*PENDING: CDMS HK MAIN*/\ uint8_t ackReceived = 0x00;\ /*PENDING: BCN TX MAIN*/\ if( ackReceived == 0xFF ){\ gCOM_MNG_TMTC_THREAD->wait(5000);\ /*PENDING: RESET CDMS*/\ }\ else{\ /*PENDING: RESET CDMS*/\ }\ }\ /*gPC.puts("COMPLETED COM_POWER_ON_TX\r\n");*/\ }