Repo for COM_MNG_TMTC_SIMPLE for integration with adf

Dependencies:   mbed-rtos mbed

Fork of COM_MNG_TMTC_SIMPLE by Shreesha S

Revision:
9:9dbd59a6cc30
Parent:
8:d1951bbdcdd8
--- a/COM_SND_TM.h	Thu Dec 31 08:39:43 2015 +0000
+++ b/COM_SND_TM.h	Thu Dec 31 09:53:39 2015 +0000
@@ -1,17 +1,7 @@
-//uncommented make_datastream flag
-//type1_frame exchanged with type0_frame
-//head->nextTM should be NULL
-//EOS should added at the end of a max_adf_length, hence there will be multiple sessions
-//reset_adf should be changed
-//position of make_DataStream changed
-//added variable segment_r
-//changed MAX_SEGMENT to 1 for testing
-//junk_f is assumed to be used only after EoS to fill the remaining 112 bytes and not for filling up the tframes whose care is taken in DLL frames.
-
 void adf_not_SDcard();
 
 #define S_FRAME_SIZE 48
-#define ISR 1
+#define ISR 40
 #define TM_FRAME_SIZE 134           //in bytes
 #define T_FRAME_SIZE 159
 #define EOS_SIZE 120
@@ -311,12 +301,12 @@
             make_DataStream_f = false;\
         }\
         if(DS_state){\
-            if(DS_counter < total_frames-type1_no){\
-                type0_frame(ptr); \
+            if(DS_counter < total_frames-type0_no){\
+                type1_frame(ptr); \
                 DS_f = true;\
             }\
             else if(DS_counter < total_frames ){\
-                type1_frame(ptr);\
+                type0_frame(ptr);\
                 DS_f = true;\
             }\
             DS_counter++;\
@@ -336,8 +326,8 @@
 
         bool reset_adf;
         SND_TM(){
-            //MAX_SEGMENTMAX_SEGMENT = (MAX_ADF_LEN-EOS_SIZE)/( S_FRAME_SIZE + ISR*T_FRAME_SIZE);
-            MAX_SEGMENT = 1;
+            MAX_SEGMENTMAX_SEGMENT = (MAX_ADF_LEN-EOS_SIZE)/( S_FRAME_SIZE + ISR*T_FRAME_SIZE);
+            //MAX_SEGMENT = 1;
                             //(max length - eos size)/(sframe length + tFrameLength*ISR)
 //            cout<<int(MAX_SEGMENT)<<endl;
         }
@@ -379,7 +369,7 @@
 
             for(RB_c = 0 ; RB_c<112 ; RB_c++){
 
-                if(junk_f){
+                if(junk_f || *last_buffer){
                     transmit[RB_c] = 0x00;
                     continue;
                 }
@@ -402,7 +392,7 @@
                         SCH40_f = false;
 
 
-                        if(Tframe_c >= LAST_SEGMENT_SIZE && segment_r != 0)
+                        if(Tframe_c >= LAST_SEGMENT_SIZE && segment_r == 0)
                         {
                             repeat_data_f = true;
                             DS_index = !DS_index;