![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
CDMS_CODE_samp_23SEP_DMA_flag
Dependencies: FreescaleIAP SimpleDMA mbed-rtos mbed
Fork of CDMS_CODE_samp_23SEP_DMA by
Diff: COM_POWER_ON_TX.h
- Revision:
- 156:f661cf9e02d1
- Parent:
- 155:ca7365c03fd7
- Child:
- 160:ef280e6dda44
diff -r ca7365c03fd7 -r f661cf9e02d1 COM_POWER_ON_TX.h --- a/COM_POWER_ON_TX.h Mon Apr 11 12:10:59 2016 +0000 +++ b/COM_POWER_ON_TX.h Wed Apr 13 12:19:35 2016 +0000 @@ -163,18 +163,17 @@ 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))) + uint8_t bcn_main_status = (tm_ptr->TM_string[2] & 0xEF); + if(( bcn_main_status == 0xC0 )||( bcn_main_status ==0xA0 )) standbyAck = 1; if( standbyAck ){ /*ACK RECCEIVED*/ - uint8_t bcn_main_status = (tm_ptr->TM_string[2] & 0xEF); - if( bcn_main_status == 0xE0 ){ + if( bcn_main_status == 0xA0 ){ retryFlag = false; RF_SW_CNTRL_TX = 1; Thread::wait(25); RF_SW_CNTRL_TX = 0; - gFLAGS = gFLAGS & (~RF_SW_STATUS_FLAG); + gFLAGS = gFLAGS & (~RF_SW_STATUS_FLAG);/*RF_SW_STATUS_FLAG set to RF_COM_TX*/ } else{ Thread::wait(5000); @@ -185,12 +184,11 @@ 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))) + uint8_t bcn_main_status2 = (tm_ptr2->TM_string[2] & 0xEF); + if( ( bcn_main_status2 == 0xC0 )||( bcn_main_status2 == 0xA0 ) ) standbyAck2 = 1; if( standbyAck2 ){ - uint8_t bcn_main_status2 = (tm_ptr2->TM_string[2] & 0xEF); - if( bcn_main_status2 == 0xE0 ){ + if( bcn_main_status2 == 0xA0 ){ retryFlag = false; RF_SW_CNTRL_TX = 1; Thread::wait(25); @@ -209,7 +207,7 @@ RF_SW_CNTRL_TX = 1; Thread::wait(25); RF_SW_CNTRL_TX = 0; - gFLAGS = gFLAGS & (~RF_SW_STATUS_FLAG); + gFLAGS = gFLAGS & (~RF_SW_STATUS_FLAG);/*RF_SW_STATUS_FLAG set to RF_COM_TX*/ } /*DELETE THE TM AFTER USE*/ Base_tm *del_tm = tm_ptr2; @@ -250,7 +248,7 @@ RF_SW_CNTRL_TX = 1; Thread::wait(25); RF_SW_CNTRL_TX = 0; - gFLAGS = gFLAGS & (~RF_SW_STATUS_FLAG); + gFLAGS = gFLAGS & (~RF_SW_STATUS_FLAG);/*RF_SW_STATUS_FLAG set to RF_COM_TX*/ } } COM_TX_CNTRL = 1; @@ -286,6 +284,8 @@ /*Call Sign, ACK_L1, TC_LIST*/ /*snd_tm.head_pointer(power_on_tm_head);*/ /*transmit_adf;*/ + uint8_t transmissionPass = 0xFF; + /*PENDING: get acknowledgement of transmission*/ /*deleting the telemetry*/ power_on_tm = power_on_tm_head; overFlowCountADF = 0; @@ -301,12 +301,16 @@ break; } } - if( true /*NOT Transmitted succesfully*/){ + if( transmissionPass == 0 ){ + /*NOT Transmitted succesfully*/ COM_POWER_OFF_TX; P_CDMS_HK_MAIN; uint8_t ackReceived = 0x00; - Base_tm *tm_ptr; + Base_tm *tm_ptr = new Short_tm; P_BCN_TX_MAIN(tm_ptr); + uint8_t ackcode = tm_ptr->TM_string[2] & 0xEF; + if( (ackcode == 0xA0) || (ackcode == 0xC0)) + ackReceived = 0xFF; if( ackReceived == 0xFF ){ Thread::wait(5000); RESET_CDMS; @@ -337,8 +341,11 @@ COM_POWER_OFF_TX; P_CDMS_HK_MAIN; uint8_t ackReceived = 0x00; - Base_tm *tm_ptr; + Base_tm *tm_ptr = new Short_tm; P_BCN_TX_MAIN(tm_ptr); + uint8_t ackcode = tm_ptr->TM_string[2] & 0xEF; + if( (ackcode == 0xA0) || (ackcode == 0xC0)) + ackReceived = 0xFF; if( ackReceived == 0xFF ){ Thread::wait(5000); RESET_CDMS;