Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: FreescaleIAP SimpleDMA mbed-rtos mbed
Fork of CDMS_CODE by
Revision 144:4c20fcc105ce, committed 2016-04-01
- Comitter:
- aniruddhv
- Date:
- Fri Apr 01 19:57:02 2016 +0000
- Parent:
- 137:489a93a04d6b
- Child:
- 155:ca7365c03fd7
- Commit message:
- Removed errors
Changed in this revision
--- 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;\
--- a/COM_POWER_ON_TX.h Thu Mar 24 04:04:33 2016 +0000
+++ b/COM_POWER_ON_TX.h Fri Apr 01 19:57:02 2016 +0000
@@ -1,13 +1,13 @@
-#define SET_BCN_STANDBY ( tm_ptr ){\
+#define SET_BCN_STANDBY(tm_ptr){\
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_DISABLE_PID;\
beacon_tc->TC_string[4] = 0x00;\
beacon_tc->TC_string[5] = 0;\
beacon_tc->TC_string[6] = 0;\
@@ -22,13 +22,13 @@
#define reset_bae {\
Base_tc *reset_BAE = new Short_tc;\
reset_BAE->next_TC = NULL;\
- PUTshort_or_long(reset_BAE,0);\
+ PUTshort_or_long(reset_BAE,SHORT_TC_CODE);\
PUTcrc_pass(reset_BAE,0x1);\
PUTexec_status(reset_BAE,0);\
reset_BAE->TC_string[0] = 0x01;\
- reset_BAE->TC_string[1] = 0x81;\
- reset_BAE->TC_string[2] = 0x81;\
- reset_BAE->TC_string[3] = 0x33;\
+ reset_BAE->TC_string[1] = BAE_APID_SOURCE;\
+ reset_BAE->TC_string[2] = BAE_SERVICE;\
+ reset_BAE->TC_string[3] = BAE_RESET_PID;\
reset_BAE->TC_string[4] = 0;\
reset_BAE->TC_string[5] = 0;\
reset_BAE->TC_string[6] = 0;\
@@ -40,13 +40,13 @@
Base_tm *tm_ptr = new Short_tm;\
tm_ptr = FCTN_CDMS_RLY_TMTC(reset_BAE);\
/*DELETE THE TM AFTER USE*/\
- obosc_tm_current = tm_ptr;\
+ Base_tm *del_tm = tm_ptr;\
int overCount = 0;\
- while( obosc_tm_current != NULL ){\
+ while( del_tm != NULL ){\
if( (overCount < TM_OVERFLOW_CONSTANT) ){\
- Base_tm *temp = obosc_tm_current->next_TM;\
- delete obosc_tm_current;\
- obosc_tm_current = temp;\
+ Base_tm *temp = del_tm->next_TM;\
+ delete del_tm;\
+ del_tm = temp;\
++overCount;\
}\
else{\
@@ -59,13 +59,13 @@
#define power_off_bae {\
Base_tc *power_off_BAE = new Short_tc;\
power_off_BAE->next_TC = NULL;\
- PUTshort_or_long(power_off_BAE,0);\
+ PUTshort_or_long(power_off_BAE,SHORT_TC_CODE);\
PUTcrc_pass(power_off_BAE,0x1);\
PUTexec_status(power_off_BAE,0);\
power_off_BAE->TC_string[0] = 0x01;\
- power_off_BAE->TC_string[1] = 0x81;\
- power_off_BAE->TC_string[2] = 0x81;\
- power_off_BAE->TC_string[3] = 0x23;\
+ power_off_BAE->TC_string[1] = BAE_APID_SOURCE;\
+ power_off_BAE->TC_string[2] = BAE_SERVICE;\
+ power_off_BAE->TC_string[3] = BAE_POWER_OFF_PID;\
power_off_BAE->TC_string[4] = 0;\
power_off_BAE->TC_string[5] = 0;\
power_off_BAE->TC_string[6] = 0;\
@@ -77,13 +77,51 @@
Base_tm *tm_ptr = new Short_tm;\
tm_ptr = FCTN_CDMS_RLY_TMTC(power_off_BAE);\
/*DELETE THE TM AFTER USE*/\
- obosc_tm_current = tm_ptr;\
+ Base_tm *del_tm = tm_ptr;\
int overCount = 0;\
- while( obosc_tm_current != NULL ){\
+ while( del_tm != NULL ){\
if( (overCount < TM_OVERFLOW_CONSTANT) ){\
- Base_tm *temp = obosc_tm_current->next_TM;\
- delete obosc_tm_current;\
- obosc_tm_current = temp;\
+ Base_tm *temp = del_tm->next_TM;\
+ delete del_tm;\
+ del_tm = temp;\
+ ++overCount;\
+ }\
+ else{\
+ /*PENDING: RESET CDMS: MEMORY LEAK FOUND*/\
+ break;\
+ }\
+ }\
+}
+
+#define P_CDMS_HK_MAIN {\
+ Base_tc *hk_main_ptr = new Short_tc;\
+ hk_main_ptr->next_TC = NULL;\
+ PUTshort_or_long(hk_main_ptr,SHORT_TC_CODE);\
+ PUTcrc_pass(hk_main_ptr,0x1);\
+ PUTexec_status(hk_main_ptr,0);\
+ hk_main_ptr->TC_string[0] = 0x01;\
+ hk_main_ptr->TC_string[1] = 0x81;\
+ hk_main_ptr->TC_string[2] = 0x81;\
+ hk_main_ptr->TC_string[3] = 0x04;\
+ hk_main_ptr->TC_string[4] = 0;\
+ hk_main_ptr->TC_string[5] = 0;\
+ hk_main_ptr->TC_string[6] = 0;\
+ hk_main_ptr->TC_string[7] = 0;\
+ hk_main_ptr->TC_string[8] = 0;\
+ uint16_t crc16 = crc16_gen(hk_main_ptr->TC_string, 9);\
+ hk_main_ptr->TC_string[9] = (crc16 & 0xFF00)>>8;\
+ hk_main_ptr->TC_string[10] = (crc16 & 0x00FF);\
+ Base_tm *tm_ptr = new Short_tm;\
+ /*PENDING*/\
+ /*tm_ptr = FCTN_CDMS_RLY_TMTC(hk_main_ptr);*/\
+ /*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{\
@@ -93,170 +131,236 @@
}\
}
-#define COM_POWER_ON_TX {\
- if (DEBUG)\
- gPC.puts("Inside COM_POWER_ON_TX\r\n");\
- if( !(gFLAGS & COM_TX_FLAG) ){\
- gFLAGS = gFLAGS | COM_TX_FLAG;\
- if( gFLAGS & BAE_SW_EN_FLAG ){\
- /*WARNING: INFINITE WHILE LOOP POSSIBLE: if standby ack received and bcn tx main status = 0*/\
- bool retryFlag = true;\
- while( retryFlag == true ){\
- Base_tm *tm_ptr = new Short_tm;\
- SET_BCN_STANDBY ( tm_ptr );\
- uint8_t standbyAck = (tm_ptr & 0xEF);\
- if( standbyAck == 0xE0 ){\
- /*ACK RECCEIVED*/\
- uint8_t bcn_main_status = 0xFF;\
- /*PENDING: BEACON TX MAIN STATUS from tm_ptr*/\
- if( bcn_main_status ){\
- retryFlag = false;\
- /*PENDING: SWITCH RELAY TO COM_TX*/\
- gFLAGS = gFLAGS & (~RF_SW_STATUS_FLAG);\
- }\
- else{\
- gCOM_MNG_TMTC_THREAD->wait(5000);\
- }\
- }\
- else{\
- reset_bae;\
- Base_tm *tm_ptr2 = new Short_tm;\
- SET_BCN_STANDBY ( tm_ptr2 );\
- uint8_t standbyAck2 = (tm_ptr2 & 0xEF);\
- if( standbyAck2 == 0xEF ){\
- uint8_t bcn_main_status = 0xFF;\
- /*PENDING: BEACON TX MAIN STATUS from tm_ptr2*/\
- if( bcn_main_status = 0xFF ){\
- retryFlag = false;\
- /*PENDING: SWITCH RF RELAY TO COM TX*/\
- gFLAGS = gFLAGS & (~RF_SW_STATUS_FLAG);\
- }\
- else{\
- gCOM_MNG_TMTC_THREAD->wait(5000);\
- }\
- }\
- else{\
- retryFlag = false;\
- power_off_bae;\
- gFLAGS = gFLAGS | COM_AUTO_POWER_OFF_BAE_FLAG;\
- gFLAGS = gFLAGS & (~BAE_SW_EN_FLAG);\
- /*PENDING: SWITCH RF RELAY TO COM TX*/\
- gFLAGS = gFLAGS & (~RF_SW_STATUS_FLAG);\
- }\
- /*DELETE THE TM AFTER USE*/\
- obosc_tm_current = tm_ptr2;\
- int overCount = 0;\
- while( obosc_tm_current != NULL ){\
- if( (overCount < TM_OVERFLOW_CONSTANT) ){\
- Base_tm *temp = obosc_tm_current->next_TM;\
- delete obosc_tm_current;\
- obosc_tm_current = temp;\
- ++overCount;\
- }\
- else{\
- /*PENDING: RESET CDMS: MEMORY LEAK FOUND*/\
- break;\
- }\
- }\
- }\
- /*DELETE THE TM AFTER USE*/\
- obosc_tm_current = tm_ptr;\
- int overCount = 0;\
- while( obosc_tm_current != NULL ){\
- if( (overCount < TM_OVERFLOW_CONSTANT) ){\
- Base_tm *temp = obosc_tm_current->next_TM;\
- delete obosc_tm_current;\
- obosc_tm_current = temp;\
- ++overCount;\
- }\
- else{\
- /*PENDING: RESET CDMS: MEMORY LEAK FOUND*/\
- break;\
- }\
- }\
- }\
- }\
- else{\
- power_off_bae;\
- gFLAGS = gFLAGS & (~BAE_SW_EN_FLAG);\
- /*PENDING: SWITCH RF RELAY TO COM TX*/\
- gFLAGS = gFLAGS & (~RF_SW_STATUS_FLAG);\
- }\
- }\
- /*PENDING: POWER ON COM_TX*/\
- /*power_on_com_tx_pin = 1;*/\
- 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);\
- /*Call Sign, ACK_L1, TC_LIST*/\
- /*snd_tm.head_pointer(power_on_tm_head);*/\
- /*transmit_adf;*/\
- /*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;\
- }\
- }\
- if(/*NOT Transmitted succesfully*/){\
- 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*/\
- }\
- }\
- }\
- 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");*/\
+#define P_BCN_TX_MAIN(tm_ptr) {\
+ Base_tc *bcn_tx_main_ptr = new Short_tc;\
+ bcn_tx_main_ptr->next_TC = NULL;\
+ PUTshort_or_long(bcn_tx_main_ptr,SHORT_TC_CODE);\
+ PUTcrc_pass(bcn_tx_main_ptr,0x1);\
+ PUTexec_status(bcn_tx_main_ptr,0);\
+ bcn_tx_main_ptr->TC_string[0] = 0x01;\
+ bcn_tx_main_ptr->TC_string[1] = 0x41;\
+ bcn_tx_main_ptr->TC_string[2] = 0x81;\
+ bcn_tx_main_ptr->TC_string[3] = 0x07;\
+ bcn_tx_main_ptr->TC_string[4] = 0;\
+ bcn_tx_main_ptr->TC_string[5] = 0;\
+ bcn_tx_main_ptr->TC_string[6] = 0;\
+ bcn_tx_main_ptr->TC_string[7] = 0;\
+ bcn_tx_main_ptr->TC_string[8] = 0;\
+ uint16_t crc16 = crc16_gen(bcn_tx_main_ptr->TC_string, 9);\
+ bcn_tx_main_ptr->TC_string[9] = (crc16 & 0xFF00)>>8;\
+ bcn_tx_main_ptr->TC_string[10] = (crc16 & 0x00FF);\
+ /*PENDING*/\
+ /*tm_ptr = FCTN_CDMS_RLY_TMTC(bcn_tx_main_ptr);*/\
+}
+
+void COM_POWER_ON_TX() {
+ if (DEBUG)
+ gPC.puts("Inside COM_POWER_ON_TX\r\n");
+ if( !(gFLAGS & COM_TX_FLAG) ){
+ gFLAGS = gFLAGS | COM_TX_FLAG;
+ if( gFLAGS & BAE_SW_EN_FLAG ){
+ /*WARNING: INFINITE WHILE LOOP POSSIBLE: if standby ack received and bcn tx main status = 0*/
+ bool retryFlag = true;
+ while( retryFlag == true ){
+ Base_tm *tm_ptr = new Short_tm;
+ SET_BCN_STANDBY(tm_ptr);
+ uint8_t standbyAck = 0;
+ uint16_t crc = crc16_gen(tm_ptr->TM_string, TM_SHORT_SIZE-2);
+ if( (tm_ptr->TM_string[11] == ((crc & 0xFF00) >> 8)) && (tm_ptr->TM_string[12] == (crc & 0x00FF)))
+ standbyAck = 1;
+ if( standbyAck ){
+ /*ACK RECCEIVED*/
+ uint8_t bcn_main_status = (tm_ptr->TM_string[2] & 0xEF);
+ if( bcn_main_status == 0xE0 ){
+ retryFlag = false;
+ RF_SW_CNTRL_TX = 1;
+ Thread::wait(25);
+ RF_SW_CNTRL_TX = 0;
+ gFLAGS = gFLAGS & (~RF_SW_STATUS_FLAG);
+ }
+ else{
+ Thread::wait(5000);
+ }
+ }
+ else{
+ reset_bae;
+ Base_tm *tm_ptr2 = new Short_tm;
+ SET_BCN_STANDBY(tm_ptr2);
+ uint8_t standbyAck2 = 0;
+ uint16_t crc2 = crc16_gen(tm_ptr2->TM_string, TM_SHORT_SIZE-2);
+ if( (tm_ptr2->TM_string[11] == ((crc2 & 0xFF00) >> 8)) && (tm_ptr2->TM_string[12] == (crc2 & 0x00FF)))
+ standbyAck2 = 1;
+ if( standbyAck2 ){
+ uint8_t bcn_main_status2 = (tm_ptr2->TM_string[2] & 0xEF);
+ if( bcn_main_status2 == 0xE0 ){
+ retryFlag = false;
+ RF_SW_CNTRL_TX = 1;
+ Thread::wait(25);
+ RF_SW_CNTRL_TX = 0;
+ gFLAGS = gFLAGS & (~RF_SW_STATUS_FLAG);
+ }
+ else{
+ Thread::wait(5000);
+ }\
+ }
+ else{
+ retryFlag = false;
+ power_off_bae;
+ gFLAGS = gFLAGS | COM_AUTO_POWER_OFF_BAE_FLAG;
+ gFLAGS = gFLAGS & (~BAE_SW_EN_FLAG);
+ RF_SW_CNTRL_TX = 1;
+ Thread::wait(25);
+ RF_SW_CNTRL_TX = 0;
+ gFLAGS = gFLAGS & (~RF_SW_STATUS_FLAG);
+ }
+ /*DELETE THE TM AFTER USE*/
+ Base_tm *del_tm = tm_ptr2;
+ 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;
+ }
+ }
+ }
+ /*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;
+ }
+ }
+ }
+ }
+ else{
+ power_off_bae;
+ gFLAGS = gFLAGS & (~BAE_SW_EN_FLAG);
+ RF_SW_CNTRL_TX = 1;
+ Thread::wait(25);
+ RF_SW_CNTRL_TX = 0;
+ gFLAGS = gFLAGS & (~RF_SW_STATUS_FLAG);
+ }
+ }
+ /*PENDING: POWER ON COM_TX*/
+ /*power_on_com_tx_pin = 1;*/
+ 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);
+ /*Call Sign, ACK_L1, TC_LIST*/
+ /*snd_tm.head_pointer(power_on_tm_head);*/
+ /*transmit_adf;*/
+ /*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;
+ }
+ }
+ if( true /*NOT Transmitted succesfully*/){
+ COM_POWER_OFF_TX;
+ P_CDMS_HK_MAIN;
+ uint8_t ackReceived = 0x00;
+ Base_tm *tm_ptr;
+ P_BCN_TX_MAIN(tm_ptr);
+ if( ackReceived == 0xFF ){
+ Thread::wait(5000);
+ /*PENDING: RESET CDMS*/
+ }
+ else{
+ /*PENDING: RESET CDMS*/
+ }
+ /*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;
+ }
+ }
+ }
+ }
+ else{
+ COM_POWER_OFF_TX;
+ P_CDMS_HK_MAIN;
+ uint8_t ackReceived = 0x00;
+ Base_tm *tm_ptr;
+ P_BCN_TX_MAIN(tm_ptr);
+ if( ackReceived == 0xFF ){
+ Thread::wait(5000);
+ /*PENDING: RESET CDMS*/
+ }
+ else{
+ /*PENDING: RESET CDMS*/
+ }
+ /*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;
+ }
+ }
+ }
+ /*gPC.puts("COMPLETED COM_POWER_ON_TX\r\n");*/
}
\ No newline at end of file
--- a/DefinitionsAndGlobals.h Thu Mar 24 04:04:33 2016 +0000
+++ b/DefinitionsAndGlobals.h Fri Apr 01 19:57:02 2016 +0000
@@ -120,7 +120,23 @@
#define PAY_SPI_MISO PTE19
#define PAY_SPI_CLK PTE17
#define PAY_SPI_CS PTE16
+
+//BEACON
+ #define BCN_APID_SOURCE 0x41
+ #define BCN_SERVICE 0x81
+ #define BCN_ENABLE_PID 0x15
+ #define BCN_DISABLE_PID 0x25
+//BAE
+ #define BAE_APID_SOURCE 0x81
+ #define BAE_SERVICE 0x81
+ #define BAE_POWER_ON_PID 0x13
+ #define BAE_POWER_OFF_PID 0x23
+ #define BAE_RESET_PID 0x33
+
+//RF RELAY
+ #define RF_RELAY_CNTRL_TX PTA7
+ #define RF_RELAY_CNTRL_BCN PTA12
// ****************GLOBAL VARIABLES******************
// DEBUG
@@ -145,6 +161,11 @@
DigitalOut gCS_RTC(SPI_CS_RTC);
Mutex SPI_mutex;
+//RF Relay
+DigitalOut RF_SW_CNTRL_BCN(RF_RELAY_CNTRL_BCN);
+DigitalOut RF_SW_CNTRL_TX(RF_RELAY_CNTRL_TX);
+
+
// TC LIST
Base_tc* gHEAD_NODE_TCL = NULL;
Base_tc* gLAST_NODE_TCL = NULL;
@@ -158,6 +179,8 @@
// COM_MNG_TMTC
+
+
// PA cooling timeout
Timeout gCOM_PA_COOLING_TIMEOUT;
--- a/P_COM_INIT.h Thu Mar 24 04:04:33 2016 +0000
+++ b/P_COM_INIT.h Fri Apr 01 19:57:02 2016 +0000
@@ -1,6 +1,8 @@
#define P_COM_INIT {\
gFLAGS = gFLAGS | COM_INIT_STATUS_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;\
/*PENDING: Reset COM receiver (0.2 seconds)*/\
gFLAGS = gFLAGS & (~COM_INIT_STATUS_FLAG);\
--- a/ThreadsAndFunctions.h Thu Mar 24 04:04:33 2016 +0000
+++ b/ThreadsAndFunctions.h Fri Apr 01 19:57:02 2016 +0000
@@ -144,7 +144,7 @@
if (DEBUG)
gPC.puts("GS code match !!\r\n");
gFLAGS = gFLAGS | COM_SESSION_VALIDITY;
- COM_POWER_ON_TX;
+ COM_POWER_ON_TX();
// PENDING: PA HOT HANDLED IN EXECUTE_XXX FUNCTIONS
uint8_t tempPAHot = 0x00;
isPAhot(tempPAHot);
@@ -217,14 +217,14 @@
test_tc = test_tc->next_TC;
}
//gPC.puts("\r\n");
- COM_POWER_ON_TX;
+ COM_POWER_ON_TX();
// PENDING : POWER OFF TX
RX1M.attach(&rx_read, Serial::RxIrq);
gFLAGS = gFLAGS & (~COM_MNG_TMTC_RUNNING_FLAG);
}
}
else{
- COM_POWER_ON_TX;
+ COM_POWER_ON_TX();
// POWER OFF TX transmitter only
// WARNING: reset_all ? clear com_session ?
RX1M.attach(&rx_read, Serial::RxIrq);
@@ -269,7 +269,7 @@
gFLAGS = gFLAGS | COM_MNG_TMTC_RUNNING_FLAG;
RX1M.attach(NULL);
gCOM_PA_COOLING_TIMEOUT.detach();
- COM_POWER_ON_TX;
+ COM_POWER_ON_TX();
EXECUTE_OBOSC_ONLY;
EXECUTE_TC;
}
--- a/main.cpp Thu Mar 24 04:04:33 2016 +0000 +++ b/main.cpp Fri Apr 01 19:57:02 2016 +0000 @@ -12,6 +12,7 @@ #include "Structures.h" #include "pinconfig.h" #include "DefinitionsAndGlobals.h" +void rx_read(); #include "crc.h" #include "i2c.h" #include "COM_SND_TM_functions.h" @@ -23,8 +24,8 @@ #include "adf.h" #include "COM_RCV_TC.h" #include "COM_MNG_TMTC.h" +#include "COM_POWER_OFF_TX.h" #include "COM_POWER_ON_TX.h" -#include "COM_POWER_OFF_TX.h" #include "Compression.h" #include "ThreadsAndFunctions.h"
