
Repository for CDMS code
Dependencies: SimpleDMA mbed-rtos mbed eeprom
Fork of COM_MNG_TMTC_SIMPLE by
Revision 186:eb19a02f83d6, committed 2016-06-17
- Comitter:
- ee12b079
- Date:
- Fri Jun 17 13:41:43 2016 +0000
- Parent:
- 185:3b3cd96a7811
- Commit message:
- Testing spi ..
Changed in this revision
--- a/COM_MNG_TMTC.h Fri Jun 17 11:36:22 2016 +0000 +++ b/COM_MNG_TMTC.h Fri Jun 17 13:41:43 2016 +0000 @@ -1232,7 +1232,7 @@ /*SEND call sign, ACK_L1, NON OBSRS TM TO GS*/\ snd_tm.head_pointer(tm_ptr_head);\ gPC.puts("enter_adf\r\n");\ - /*transmit_adf;*/\ + transmit_adf;\ gPC.puts("exit_adf\r\n");\ /*DELETE THE TM AFTER USE*/\ tm_ptr = tm_ptr_head;\ @@ -1260,7 +1260,7 @@ /*read_TC(current_TC);*/\ execute_OBSRS_TC(current_TC);\ gPC.puts("enter_adf\r\n");\ - /*transmit_adf;*/\ + transmit_adf;\ gPC.puts("exit_adf\r\n");\ uint8_t tempExec = TC_STATE_SUCCESSFULLY_EXECUTED;\ PUTexec_status(current_TC, tempExec);\
--- a/Compression.h Fri Jun 17 11:36:22 2016 +0000 +++ b/Compression.h Fri Jun 17 13:41:43 2016 +0000 @@ -285,7 +285,7 @@ space = adjust(1,0,pointer,8); space = adjust(4,3,pointer,space); FSC_science = FCTN_SD_MNGR(3); - //gPC.printf("SID = 3, FSC = %02X\r\n", FSC_science); + gPC.printf("SID = 3, FSC = %02X\r\n", FSC_science); frames[id][1] = (FSC_science>>24)&0xff; frames[id][2] = (FSC_science>>16)&0xff; frames[id][3] = (FSC_science>>8)&0xff; @@ -300,7 +300,7 @@ space = adjust(4,2,pointer,space); FSC_science = FCTN_SD_MNGR(2); - // gPC.printf("SID = 2, FSC = %02X\r\n", FSC_science); + gPC.printf("SID = 2, FSC = %02X\r\n", FSC_science); frames[id][1] = (FSC_science>>16)&0xff; frames[id][2] = (FSC_science>>8)&0xff; frames[id][3] = FSC_science&0xff; @@ -584,7 +584,7 @@ space = adjust(1,0,pointer,8); space = adjust(4,1,pointer,space); FSC_science = FCTN_SD_MNGR(1); - //gPC.printf("SID = 1, FSC = %02X\r\n", FSC_science); + gPC.printf("SID = 1, FSC = %02X\r\n", FSC_science); frames[id][1] = (FSC_science>>16)&0xff; frames[id][2] = (FSC_science>>8)&0xff; frames[id][3] = (FSC_science)&0xff;
--- a/ThreadsAndFunctions.h Fri Jun 17 11:36:22 2016 +0000 +++ b/ThreadsAndFunctions.h Fri Jun 17 13:41:43 2016 +0000 @@ -24,6 +24,51 @@ } //COM THREAD + +#define STANDBY_SCIENCE_PL(tm_ptr) {\ + Base_tc *linktest_tc = new Short_tc;\ + linktest_tc->next_TC = NULL;\ + PUTshort_or_long(linktest_tc,SHORT_TC_CODE);\ + PUTcrc_pass(linktest_tc,0x1);\ + PUTexec_status(linktest_tc,0);\ + linktest_tc->TC_string[0] = 0x01;\ + linktest_tc->TC_string[1] = 0xC0;\ + linktest_tc->TC_string[2] = 0x81;\ + linktest_tc->TC_string[3] = 0x2;\ + linktest_tc->TC_string[4] = 0;\ + linktest_tc->TC_string[5] = 0;\ + linktest_tc->TC_string[6] = 0;\ + linktest_tc->TC_string[7] = 0;\ + linktest_tc->TC_string[8] = 0;\ + uint16_t crc16 = crc16_gen(linktest_tc->TC_string, 9);\ + linktest_tc->TC_string[9] = (crc16 & 0xFF00)>>8;\ + linktest_tc->TC_string[10] = (crc16 & 0x00FF);\ + tm_ptr = FCTN_CDMS_RLY_TMTC(linktest_tc);\ +} + +#define INIT_SCIENCE_PL(tm_ptr) {\ + Base_tc *linktest_tc = new Short_tc;\ + linktest_tc->next_TC = NULL;\ + PUTshort_or_long(linktest_tc,SHORT_TC_CODE);\ + PUTcrc_pass(linktest_tc,0x1);\ + PUTexec_status(linktest_tc,0);\ + linktest_tc->TC_string[0] = 0x02;\ + linktest_tc->TC_string[1] = 0xC0;\ + linktest_tc->TC_string[2] = 0x81;\ + linktest_tc->TC_string[3] = 0x4;\ + linktest_tc->TC_string[4] = 0;\ + linktest_tc->TC_string[5] = 0;\ + linktest_tc->TC_string[6] = 0;\ + linktest_tc->TC_string[7] = 0;\ + linktest_tc->TC_string[8] = 0;\ + uint16_t crc16 = crc16_gen(linktest_tc->TC_string, 9);\ + linktest_tc->TC_string[9] = (crc16 & 0xFF00)>>8;\ + linktest_tc->TC_string[10] = (crc16 & 0x00FF);\ + tm_ptr = FCTN_CDMS_RLY_TMTC(linktest_tc);\ +} + + + // UART ISR void rx_read(){ gRX_CURRENT_DATA_NODE->values[gRX_COUNT] = RX1M.getc(); @@ -105,6 +150,22 @@ gFLAGS = gFLAGS & (~UART_INT_FLAG); if( !(gFLAGS & COM_SESSION_FLAG) ){ // PENDING : DISABLE THREADS + Base_tm *tm_ptr = new Short_tm; + STANDBY_SCIENCE_PL(tm_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{\ + break;\ + }\ + }\ gFLAGS = gFLAGS | COM_SESSION_FLAG; gSESSION_TIMEOUT.attach(&after_session, SESSION_TIME_LIMIT); gFLAGS = gFLAGS | COM_RX_FLAG; @@ -188,6 +249,22 @@ reset_all; gFLAGS = gFLAGS & (~COM_SESSION_VALIDITY); // PENDING : ENABLE THREADS + Base_tm *tm_ptr = new Short_tm; + INIT_SCIENCE_PL(tm_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{\ + break;\ + }\ + }\ gSESSION_TIMEOUT.detach(); gFLAGS = gFLAGS & (~COM_SESSION_FLAG); // WARNING: clear COM_MNG_TMTC ?
--- a/main.cpp Fri Jun 17 11:36:22 2016 +0000 +++ b/main.cpp Fri Jun 17 13:41:43 2016 +0000 @@ -33,41 +33,12 @@ #include "Compression.h" #include "ThreadsAndFunctions.h" -#define PL_TC(tm_ptr){\ - Base_tc *beacon_tc = new Short_tc;\ - beacon_tc->next_TC = NULL;\ - 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] = 0xE0;\ - beacon_tc->TC_string[2] = 0x81;\ - beacon_tc->TC_string[3] = 0xD0;\ - beacon_tc->TC_string[4] = 0x00;\ - beacon_tc->TC_string[5] = 0;\ - beacon_tc->TC_string[6] = 0;\ - beacon_tc->TC_string[7] = 0;\ - beacon_tc->TC_string[8] = 0;\ - uint16_t crc16 = crc16_gen(beacon_tc->TC_string, 9);\ - beacon_tc->TC_string[9] = (crc16 & 0xFF00)>>8;\ - beacon_tc->TC_string[10] = (crc16 & 0x00FF);\ - tm_ptr = FCTN_CDMS_RLY_TMTC(beacon_tc);\ -} - //void set_sig(){gSCIENCE_THREAD->signal_set(SCIENCE_SIGNAL);} int main() { CDMS_I2C_GPIO = 0; PYLD_I2C_GPIO = 0; - - gPC.printf("PL_TC sending\r\n"); - - Base_tm *tm_ptr = new Short_tm; - PL_TC(tm_ptr); - - gPC.printf("PL_TC sent"); - //gLEDR = 1; // ******************INITIALISATIONS START****************** @@ -119,6 +90,25 @@ master.frequency(400000); + Base_tm *tm_ptr = new Short_tm; + INIT_SCIENCE_PL(tm_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{\ + break;\ + }\ + }\ + + gPC.puts("waiting for PL data\r\n"); + // *******************INITIALISATIONS END******************** //RtosTimer gCDMS_HK_TIMER(FCTN_CDMS_HK_MAIN, osTimerPeriodic);