lkdsnf;
Dependencies: FreescaleIAP SimpleDMA mbed-rtos mbed
Fork of COM_MNG_TMTC_SIMPLE_PL_Working by
Diff: COM_MNG_TMTC.h
- Revision:
- 76:adba77e6bdb5
- Parent:
- 75:d03b5d6ef269
- Child:
- 77:11318af9b144
--- a/COM_MNG_TMTC.h Tue Jan 19 05:55:44 2016 +0000 +++ b/COM_MNG_TMTC.h Tue Jan 19 05:56:28 2016 +0000 @@ -427,7 +427,7 @@ // CDMS TEAM CODE START inline Base_tm* FCTN_CDMS_RLY_TMTC(Base_tc *tc_ptr){ uint8_t ACKCODE = 0x00; - //gPC.printf("\rTC execution in progress\r\n"); + //printf("\rTC execution in progress\r\n"); Base_tm *tm_pointer = new Long_tm; Base_tm *tm_ptr = tm_pointer; received = 0; @@ -435,17 +435,17 @@ { case 1: //apid=01 implies it corresponds to bae { - //gPC.printf("Telecommand is for BAE\r\n"); - //gPC.printf("Sending TC to BAE...\r\n"); //interrupt to be sent to the bae + //printf("Telecommand is for BAE\r\n"); + //printf("Sending TC to BAE...\r\n"); //interrupt to be sent to the bae FCTN_I2C_WRITE((char*)tc_ptr->TC_string); while(1) { wait(1); //TimeOut instead of wait if(tm_status_4m_slv == 1) { - //gPC.printf("receiving...\r\n"); + //printf("receiving...\r\n"); FCTN_I2C_READ((char*)tm_pointer->TM_string); - //gPC.printf("%s", tm_pointer->TM_string); + //printf("%s", tm_pointer->TM_string); received+=1; tm_pointer = tm_pointer->next_TM; break; //only for testing purpose @@ -457,11 +457,11 @@ } if(received >= 1 ) { - //gPC.printf("Telemetry is received from BAE\r\n"); + //printf("Telemetry is received from BAE\r\n"); Base_tm *tm_print = tm_ptr; for(uint8_t i=0;i<received;i++) { - //gPC.printf("%s", tm_print->TM_string); + //printf("%s", tm_print->TM_string); tm_print = tm_print->next_TM; //for check } received = 0; @@ -469,7 +469,7 @@ } else { - //gPC.printf("Telemetry is not received from BAE\r\n"); + //printf("Telemetry is not received from BAE\r\n"); //tm_pointer = new Short_tm; tm_pointer->TM_string[0] = 0xB0; tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr); @@ -489,7 +489,7 @@ } case 2: { - //gPC.printf("Telecommand is for CDMS\r\n"); //apid = 10 corresponds to cdms + //printf("Telecommand is for CDMS\r\n"); //apid = 10 corresponds to cdms switch(GETservice_type(tc_ptr)) { case 0x60: @@ -499,7 +499,7 @@ { case 0x1: { - //gPC.printf("sub_service:Read from RAM_Memory\r\n"); + //printf("sub_service:Read from RAM_Memory\r\n"); mid=(uint16_t)(tc_ptr->TC_string[3]<<4)+(uint16_t)(tc_ptr->TC_string[4]); Data[0] = FCTN_CDMS_RD_FLASH(0); @@ -523,7 +523,7 @@ } case 0x2: { - //gPC.printf("sub_service:Read from Flash_Memory\r\n"); + //printf("sub_service:Read from Flash_Memory\r\n"); mid=(uint16_t)(tc_ptr->TC_string[3]<<4)+(uint16_t)(tc_ptr->TC_string[4]); Data[0] = FCTN_CDMS_RD_FLASH(0); @@ -547,7 +547,7 @@ } case 0x5: { - //gPC.printf("WRITE ON FLASH_MEMORY\r\n"); + //printf("WRITE ON FLASH_MEMORY\r\n"); mid=(uint16_t)(tc_ptr->TC_string[3]<<4)+(uint16_t)(tc_ptr->TC_string[4]); block = (((uint32_t)(tc_ptr->TC_string[5])<<24)|((uint32_t)(tc_ptr->TC_string[5])<<16)|((uint32_t)(tc_ptr->TC_string[5])<<8)|((uint32_t)(tc_ptr->TC_string[5]))); FCTN_CDMS_WR_FLASH(mid,block); @@ -569,7 +569,7 @@ } default: { - //gPC.printf("INVALID TC\r\n"); //Send Invalid TC Telemetry + //printf("INVALID TC\r\n"); //Send Invalid TC Telemetry //tm_pointer = new Short_tm; tm_pointer->TM_string[0] = 0xB0; tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr); @@ -590,12 +590,12 @@ } case 0x8: { - //gPC.printf("service:FUNCTION MANAGEMENT SERVICE\r\n"); + //printf("service:FUNCTION MANAGEMENT SERVICE\r\n"); if(GETservice_subtype(tc_ptr)==0x1) { if(GETpid(tc_ptr)==0x01) { - //gPC.printf("TC_PL_INIT\r\n"); // call PWR_SWCH_ON function + //printf("TC_PL_INIT\r\n"); // call PWR_SWCH_ON function //tm_pointer = new Short_tm; tm_pointer->TM_string[0] = 0xB0; tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr); @@ -612,7 +612,7 @@ } else if(GETpid(tc_ptr)==0x02) { - //gPC.printf("TC_PL_MAIN\r\n"); // call PWR_SWCH_ON function + //printf("TC_PL_MAIN\r\n"); // call PWR_SWCH_ON function //tm_pointer = new Short_tm; tm_pointer->TM_string[0] = 0xB0; tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr); @@ -629,7 +629,7 @@ } else if(GETpid(tc_ptr)==0x03) { - //gPC.printf("TC_COM_INIT\r\n"); // call PWR_SWCH_ON function + //printf("TC_COM_INIT\r\n"); // call PWR_SWCH_ON function //tm_pointer = new Short_tm; tm_pointer->TM_string[0] = 0xB0; tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr); @@ -646,7 +646,7 @@ } else if(GETpid(tc_ptr)==0x04) { - //gPC.printf("TC_CDMS_HK_MAIN\r\n"); // call PWR_SWCH_ON function + //printf("TC_CDMS_HK_MAIN\r\n"); // call PWR_SWCH_ON function //tm_pointer = new Short_tm; tm_pointer->TM_string[0] = 0xB0; tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr); @@ -663,7 +663,7 @@ } else if(GETpid(tc_ptr)==0x11) { - //gPC.printf("TC_SW_ON_SD\r\n"); // call PWR_SWCH_ON function + //printf("TC_SW_ON_SD\r\n"); // call PWR_SWCH_ON function //tm_pointer = new Short_tm; tm_pointer->TM_string[0] = 0xB0; tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr); @@ -680,7 +680,7 @@ } else if(GETpid(tc_ptr)==0x12) { - //gPC.printf("TC_SW_ON_RTC\r\n"); // call PWR_SWCH_ON function + //printf("TC_SW_ON_RTC\r\n"); // call PWR_SWCH_ON function //tm_pointer = new Short_tm; tm_pointer->TM_string[0] = 0xB0; tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr); @@ -697,7 +697,7 @@ } else if(GETpid(tc_ptr)==0x13) { - //gPC.printf("TC_SW_ON_BAE\r\n"); // call PWR_SWCH_ON function + //printf("TC_SW_ON_BAE\r\n"); // call PWR_SWCH_ON function //tm_pointer = new Short_tm; tm_pointer->TM_string[0] = 0xB0; tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr); @@ -714,7 +714,7 @@ } else if(GETpid(tc_ptr)==0x14) { - //gPC.printf("TC_SW_ON_PL_DL\r\n"); // call PWR_SWCH_ON function + //printf("TC_SW_ON_PL_DL\r\n"); // call PWR_SWCH_ON function //tm_pointer = new Short_tm; tm_pointer->TM_string[0] = 0xB0; tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr); @@ -731,7 +731,7 @@ } else if(GETpid(tc_ptr)==0x15) { - //gPC.printf("TC_SW_ON_PL_AG_HV\r\n"); // call PWR_SWCH_ON function + //printf("TC_SW_ON_PL_AG_HV\r\n"); // call PWR_SWCH_ON function //tm_pointer = new Short_tm; tm_pointer->TM_string[0] = 0xB0; tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr); @@ -748,7 +748,7 @@ } else if(GETpid(tc_ptr)==0x16) { - //gPC.printf("TC_SW_ON_V_A_EN\r\n"); // call PWR_SWCH_ON function + //printf("TC_SW_ON_V_A_EN\r\n"); // call PWR_SWCH_ON function //tm_pointer = new Short_tm; tm_pointer->TM_string[0] = 0xB0; tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr); @@ -765,7 +765,7 @@ } else if(GETpid(tc_ptr)==0x21) { - //gPC.printf("TC_SW_OFF_SD\r\n"); // call PWR_SWCH_ON function + //printf("TC_SW_OFF_SD\r\n"); // call PWR_SWCH_ON function //tm_pointer = new Short_tm; tm_pointer->TM_string[0] = 0xB0; tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr); @@ -782,7 +782,7 @@ } else if(GETpid(tc_ptr)==0x22) { - //gPC.printf("TC_SW_OFF_RTC\r\n"); // call PWR_SWCH_ON function + //printf("TC_SW_OFF_RTC\r\n"); // call PWR_SWCH_ON function //tm_pointer = new Short_tm; tm_pointer->TM_string[0] = 0xB0; tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr); @@ -799,7 +799,7 @@ } else if(GETpid(tc_ptr)==0x23) { - //gPC.printf("TC_SW_OFF_BAE\r\n"); // call PWR_SWCH_ON function + //printf("TC_SW_OFF_BAE\r\n"); // call PWR_SWCH_ON function //tm_pointer = new Short_tm; tm_pointer->TM_string[0] = 0xB0; tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr); @@ -816,7 +816,7 @@ } else if(GETpid(tc_ptr)==0x24) { - //gPC.printf("TC_SW_OFF_PL_DL\r\n"); // call PWR_SWCH_ON function + //printf("TC_SW_OFF_PL_DL\r\n"); // call PWR_SWCH_ON function //tm_pointer = new Short_tm; tm_pointer->TM_string[0] = 0xB0; tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr); @@ -833,7 +833,7 @@ } else if(GETpid(tc_ptr)==0x25) { - //gPC.printf("TC_SW_OFF_PL_AG_HV\r\n"); // call PWR_SWCH_ON function + //printf("TC_SW_OFF_PL_AG_HV\r\n"); // call PWR_SWCH_ON function //tm_pointer = new Short_tm; tm_pointer->TM_string[0] = 0xB0; tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr); @@ -850,7 +850,7 @@ } else if(GETpid(tc_ptr)==0x26) { - //gPC.printf("TC_SW_OFF_V_A_EN\r\n"); // call PWR_SWCH_ON function + //printf("TC_SW_OFF_V_A_EN\r\n"); // call PWR_SWCH_ON function //tm_pointer = new Short_tm; tm_pointer->TM_string[0] = 0xB0; tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr); @@ -867,7 +867,7 @@ } else if(GETpid(tc_ptr)==0x31) { - //gPC.printf("TC_RST_SD\r\n"); // call PWR_SWCH_ON function + //printf("TC_RST_SD\r\n"); // call PWR_SWCH_ON function //tm_pointer = new Short_tm; tm_pointer->TM_string[0] = 0xB0; tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr); @@ -884,7 +884,7 @@ } else if(GETpid(tc_ptr)==0x32) { - //gPC.printf("TC_RST_RTC\r\n"); // call PWR_SWCH_ON function + //printf("TC_RST_RTC\r\n"); // call PWR_SWCH_ON function //tm_pointer = new Short_tm; tm_pointer->TM_string[0] = 0xB0; tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr); @@ -901,7 +901,7 @@ } else if(GETpid(tc_ptr)==0x33) { - //gPC.printf("TC_RST_BAE\r\n"); // call PWR_SWCH_ON function + //printf("TC_RST_BAE\r\n"); // call PWR_SWCH_ON function //tm_pointer = new Short_tm; tm_pointer->TM_string[0] = 0xB0; tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr); @@ -918,7 +918,7 @@ } else if(GETpid(tc_ptr)==0x34) { - //gPC.printf("TC_RST_PL_DL\r\n"); // call PWR_SWCH_ON function + //printf("TC_RST_PL_DL\r\n"); // call PWR_SWCH_ON function //tm_pointer = new Short_tm; tm_pointer->TM_string[0] = 0xB0; tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr); @@ -936,7 +936,7 @@ } else if(GETpid(tc_ptr)==0xC1) { - //gPC.printf("RESET_HK_COUNTER\r\n"); // call PWR_SWCH_ON function + //printf("RESET_HK_COUNTER\r\n"); // call PWR_SWCH_ON function //tm_pointer = new Short_tm; tm_pointer->TM_string[0] = 0xB0; tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr); @@ -953,7 +953,7 @@ } else if(GETpid(tc_ptr)==0xF1) { - //gPC.printf("RD_RTC\r\n"); //call RD_RTC + //printf("RD_RTC\r\n"); //call RD_RTC //tm_pointer = new Short_tm; tm_pointer->TM_string[0] = 0xD0; tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr); @@ -974,7 +974,7 @@ } else { - //gPC.printf("INVALID TC\r\n"); + //printf("INVALID TC\r\n"); //tm_pointer = new Short_tm; tm_pointer->TM_string[0] = 0xB0; tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr); @@ -996,7 +996,7 @@ } default: { - //gPC.printf("INVALID TC"); //send invalid TC TM + //printf("INVALID TC"); //send invalid TC TM //tm_pointer = new Short_tm; tm_pointer->TM_string[0] = 0xB0; tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr); @@ -1017,10 +1017,10 @@ } case 3: { - //gPC.printf("Telecommand is for PL\r\n"); - // gPC.printf("Informing PL about TC using I2C\r\n"); //interrupt to be sent to the bae + //printf("Telecommand is for PL\r\n"); + // printf("Informing PL about TC using I2C\r\n"); //interrupt to be sent to the bae // FCTN_I2C_WRITE((char*)tc_ptr->TC_string); - // //gPC.printf("sent the Telecommand to BAE\r\n"); //packet along with crc will be sent when bae is ready + // printf("sent the Telecommand to BAE\r\n"); //packet along with crc will be sent when bae is ready // wait(1); //wait time is to be optimised // if(tm_status_4m_slv == 1) // { @@ -1029,15 +1029,15 @@ // } // if(received == 1 ) // { - // //gPC.printf("Telemetry is received from BAE\r\n"); - // //gPC.printf("%s", tm_ptr->TM_string); + // printf("Telemetry is received from BAE\r\n"); + // printf("%s", tm_ptr->TM_string); // received = 0; // } // similar to BAE functions break; } default: //invalid TC { - //gPC.printf("INVALID TC\r\n"); + //printf("INVALID TC\r\n"); //tm_pointer = new Short_tm; tm_pointer->TM_string[0] = 0xB0; tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr); @@ -1260,7 +1260,12 @@ snd_tm.head_pointer(obosc_tm_head);\ adf_not_SDcard;\ }\ - } + delete_all_tm(obosc_tm_head);\ + if ( reset_flag == 1 ){\ + reset_all;\ + break;\ + }\ +} #define EXECUTE_TC {\ gMASTER_STATE = TCL_STATE_EXECUTING;\ @@ -1277,7 +1282,7 @@ uint8_t current_exec_status = GETexec_status(current_TC);\ if( (current_exec_status == TC_STATE_SUCCESSFULLY_EXECUTED) || (current_exec_status == TC_STATE_DISABLED) ){\ /*gPC.printf("disabled or completed at %u\n", execute_psc);*/\ - if( execute_psc == (gTOTAL_VALID_TC-1) ){\ + if( execute_psc == (gTOTAL_VALID_TC-1) ){\ gMASTER_STATE = TCL_STATE_COMPLETED;\ Base_tm *tm_ptr_head = NULL;\ get_call_sign(tm_ptr_head);\ @@ -1297,10 +1302,38 @@ get_call_sign(tm_ptr_head);\ Base_tm *tm_ptr = tm_ptr_head;\ get_ack_l1(tm_ptr->next_TM);\ - /*Send only call sign, ACK_L1*/\ - snd_tm.head_pointer(tm_ptr_head);\ - adf_not_SDcard;\ - delete_all_tm(tm_ptr_head);\ + tm_ptr = tm_ptr_head;\ + while( tm_ptr != NULL ){\ + int length = TM_SHORT_SIZE;\ + if( GETshort_or_long_tm(tm_ptr->fields) == SHORT_TM_CODE ){\ + length = TM_SHORT_SIZE;\ + }\ + else{\ + length = TM_LONG_SIZE;\ + }\ + /*gPC.puts("Printing Call Sign, ACK_L1, TM list");*/\ + for(int i = 0 ; i < length ; ++i){\ + /*gPC.putc(tm_ptr->TM_string[i]);*/\ + }\ + tm_ptr = tm_ptr->next_TM;\ + }\ + /*snd_tm.head_pointer(tm_ptr_head);*/\ + /*adf_not_SDcard;*/\ + /*DELETE THE TM AFTER USE*/\ + tm_ptr = tm_ptr_head;\ + int overflowCountExecute = 0;\ + while(tm_ptr != NULL){\ + if( overflowCountExecute < TM_OVERFLOW_CONSTANT ){\ + Base_tm *temp = tm_ptr->next_TM;\ + delete tm_ptr;\ + tm_ptr = temp;\ + ++overflowCountExecute;\ + }\ + else{\ + /*PENDING: RESET CDMS*/\ + break;\ + }\ + }\ break;\ }\ else if( (current_exec_status == TC_STATE_UNEXECUTED) || (current_exec_status == TC_STATE_MARKED_RETRY) ){\ @@ -1320,9 +1353,6 @@ /*gPC.printf("obosc tc inside normal tc at %u\r\n", execute_psc);*/\ /*EXECUTION OF OBOSC TC*/\ /*SKIP EXECUTION OF OBOSC HERE*/\ - if( execute_psc == (gTOTAL_VALID_TC-1) ){\ - gMASTER_STATE = TCL_STATE_COMPLETED;\ - }\ break;\ }\ else{\ @@ -1352,6 +1382,25 @@ /*LAST TC IS EXECUTED*/\ gMASTER_STATE = TCL_STATE_COMPLETED;\ }\ + else{\ + uint8_t check1 = 1;\ + for( uint8_t test_psc = execute_psc+1 ; test_psc < gTOTAL_VALID_TC ; ++test_psc ){\ + Base_tc* test_TC = gHEAD_NODE_TCL;\ + while(test_TC != NULL){\ + if( GETpacket_seq_count(test_TC) == test_psc ){\ + uint8_t checkval;\ + isit_obosc(test_TC, checkval);\ + if( checkval == 0 ){\ + check1 = 0;\ + }\ + }\ + test_TC = test_TC->next_TC;\ + }\ + }\ + if( check1 == 0x01 ){\ + gMASTER_STATE = TCL_STATE_COMPLETED;\ + }\ + }\ /*update last executed L1_ack*/\ if( put_tm_here != NULL ){\ if( GETshort_or_long_tm(put_tm_here->fields) == SHORT_TM_CODE ){\ @@ -1387,10 +1436,39 @@ if( tempPAhot == 0x00 ){\ gFLAGS = gFLAGS | COM_PA_HOT_FLAG;\ }\ - /*Send call sign, ACK_L1, NON OBSRS TM*/\ + tm_ptr = tm_ptr_head;\ + while( tm_ptr != NULL ){\ + int length = TM_SHORT_SIZE;\ + if( GETshort_or_long_tm(tm_ptr->fields) == SHORT_TM_CODE ){\ + length = TM_SHORT_SIZE;\ + }\ + else{\ + length = TM_LONG_SIZE;\ + }\ + /*gPC.puts("Printing Call Sign, ACK_L1, TM list");*/\ + for(int i = 0 ; i < length ; ++i){\ + /*gPC.putc(tm_ptr->TM_string[i]);*/\ + }\ + tm_ptr = tm_ptr->next_TM;\ + }\ + /*SEND DATA TO GS*/\ snd_tm.head_pointer(tm_ptr_head);\ adf_not_SDcard;\ - delete_all_tm(tm_ptr_head);\ + /*DELETE THE TM AFTER USE*/\ + tm_ptr = tm_ptr_head;\ + overflowCountExecute = 0;\ + while(tm_ptr != NULL){\ + if( overflowCountExecute < TM_OVERFLOW_CONSTANT ){\ + Base_tm *temp = tm_ptr->next_TM;\ + delete tm_ptr;\ + tm_ptr = temp;\ + ++overflowCountExecute;\ + }\ + else{\ + /*PENDING: RESET CDMS*/\ + break;\ + }\ + }\ }\ else{\ /*gPC.printf("sd card at %u\r\n", execute_psc);*/\ @@ -1402,13 +1480,47 @@ /*read_TC(current_TC);*/\ uint8_t tempExec = TC_STATE_SUCCESSFULLY_EXECUTED;\ PUTexec_status(current_TC, tempExec);\ - /*PENDING: ABORT ON NACK CHECK, gMASTER_STATE VERIFICATION WITH SD CARD,PA hot and session timeout, last executed ack l234*/\ + /*PENDING: ABORT ON NACK CHECK, gMASTER_STATE VERIFICATION WITH SD CARD, session timeout, last executed ack l234*/\ if( (GETexec_status(current_TC) == TC_STATE_EXECUTION_FAILED) && (GETabort_on_nack(current_TC) == 1) ){\ gMASTER_STATE = TCL_STATE_ABORTED;\ }\ else if( execute_psc == (gTOTAL_VALID_TC-1) ){\ gMASTER_STATE = TCL_STATE_COMPLETED;\ }\ + else{\ + uint8_t check1 = 1;\ + for( uint8_t test_psc = execute_psc+1 ; test_psc < gTOTAL_VALID_TC ; ++test_psc ){\ + Base_tc* test_TC = gHEAD_NODE_TCL;\ + while(test_TC != NULL){\ + if( GETpacket_seq_count(test_TC) == test_psc ){\ + uint8_t checkval;\ + isit_obosc(test_TC, checkval);\ + if( checkval == 0 ){\ + check1 = 0;\ + }\ + }\ + test_TC = test_TC->next_TC;\ + }\ + }\ + if( check1 == 0x01 ){\ + gMASTER_STATE = TCL_STATE_COMPLETED;\ + }\ + }\ + /*update last executed L1_ack*/\ + if( put_tm_here != NULL ){\ + if( GETshort_or_long_tm(put_tm_here->fields) == SHORT_TM_CODE ){\ + for(int i = 0 ; i < TM_SHORT_SIZE ; ++i){\ + gLAST_TM[i] = put_tm_here->TM_string[i];\ + gLAST_TM_SHORT_OR_LONG = SHORT_TM_CODE;\ + }\ + }\ + else{\ + for( int i = 0 ; i < TM_LONG_SIZE ; ++i ){\ + gLAST_TM[i] = put_tm_here->TM_string[i];\ + gLAST_TM_SHORT_OR_LONG = LONG_TM_CODE;\ + }\ + }\ + }\ /*PENDING: APPEND ACK L1*/\ Base_tm *tm_ptr = tm_ptr_head;\ get_ack_l1(tm_ptr->next_TM);\ @@ -1430,10 +1542,39 @@ if( tempPAhot == 0x00 ){\ gFLAGS = gFLAGS | COM_PA_HOT_FLAG;\ }\ - /*Send only call sign, ACK_L1, OBSRS TM*/\ - snd_tm.head_pointer(tm_ptr_head);\ - adf_not_SDcard;\ - delete_all_tm(tm_ptr_head);\ + tm_ptr = tm_ptr_head;\ + while( tm_ptr != NULL ){\ + int length = TM_SHORT_SIZE;\ + if( GETshort_or_long_tm(tm_ptr->fields) == SHORT_TM_CODE ){\ + length = TM_SHORT_SIZE;\ + }\ + else{\ + length = TM_LONG_SIZE;\ + }\ + /*gPC.puts("Printing Call Sign, ACK_L1, TM list");*/\ + for(int i = 0 ; i < length ; ++i){\ + /*gPC.putc(tm_ptr->TM_string[i]);*/\ + }\ + tm_ptr = tm_ptr->next_TM;\ + }\ + /*SEND DATA TO GS*/\ + /*snd_tm.head_pointer(tm_ptr_head);*/\ + /*adf_SDcard();*/\ + /*DELETE THE TM AFTER USE*/\ + tm_ptr = tm_ptr_head;\ + overflowCountExecute = 0;\ + while(tm_ptr != NULL){\ + if( overflowCountExecute < TM_OVERFLOW_CONSTANT ){\ + Base_tm *temp = tm_ptr->next_TM;\ + delete tm_ptr;\ + tm_ptr = temp;\ + ++overflowCountExecute;\ + }\ + else{\ + /*PENDING: RESET CDMS*/\ + break;\ + }\ + }\ }\ }\ break;\