Repository for CDMS code

Dependencies:   SimpleDMA mbed-rtos mbed eeprom

Fork of COM_MNG_TMTC_SIMPLE by Shreesha S

Revision:
186:eb19a02f83d6
Parent:
185:3b3cd96a7811
diff -r 3b3cd96a7811 -r eb19a02f83d6 main.cpp
--- 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);