Compression code changed and RLY_TMTC pointers managed

Dependencies:   FreescaleIAP SimpleDMA mbed-rtos mbed

Fork of CDMS_CODE by shubham c

Files at this revision

API Documentation at this revision

Comitter:
prasanthbj05
Date:
Sat Jul 16 16:04:14 2016 +0000
Parent:
265:ae588e75cfa4
Commit message:
Compression code changed according to modified beacon format.;

Changed in this revision

Compression.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r ae588e75cfa4 -r 783c248a6207 Compression.h
--- a/Compression.h	Fri Jul 15 14:59:27 2016 +0000
+++ b/Compression.h	Sat Jul 16 16:04:14 2016 +0000
@@ -536,43 +536,47 @@
 
     if(beacon_cntr == 1)
     {
-        beacon_ptr = &(beacon_array[62]);   // starting block address, stores the oldest(among the 5 most recent) beacon packet
+        beacon_ptr = &(beacon_array[47]);   // starting block address, stores the oldest(among the 5 most recent) beacon packet
     }
     else if(beacon_cntr>1 && beacon_cntr<6)
     {
-        beacon_ptr +=14;                    // increase the block number(totally 5 blocks for 5 beacon packets)
+        beacon_ptr +=17;                    // increase the block number(totally 5 blocks for 5 beacon packets)
     }
     else if(beacon_cntr == 6)
     {
-        for(uint16_t i=0;i<14;i++)          // when all 5 blocks have been used shift the last 4 blocks up along the array and
+        for(uint16_t i=0;i<17;i++)          // when all 5 blocks have been used shift the last 4 blocks up along the array and
         {                                   // overwrite the new beacon packet in the 5th block
-            beacon_array[62+i] = beacon_array[76+i];
-            beacon_array[76+i] = beacon_array[90+i];
-            beacon_array[90+i] = beacon_array[104+i];
-            beacon_array[104+i] = beacon_array[118+i];
+            beacon_array[47+i] = beacon_array[64+i];
+            beacon_array[64+i] = beacon_array[81+i];
+            beacon_array[81+i] = beacon_array[98+i];
+            beacon_array[98+i] = beacon_array[115+i];
         }
-        beacon_ptr = &(beacon_array[118]);  //address of the 5th block
+        beacon_ptr = &(beacon_array[115]);  //address of the 5th block
         beacon_cntr = 5;
     }
     pointer = beacon_ptr;        debug_cntr = 0;     space = 8;
-    space = adjust(1, 1,pointer,space);     pointer += space>>4;    debug_cntr += space>>4;
-    space = adjust(5,(sci_time>>8)&0x1f,pointer,space);     pointer += space>>4;    debug_cntr += space>>4;
-    space = adjust(8, sci_time,pointer,space);      pointer += space>>4;    debug_cntr += space>>4;
-    space = adjust(4, (attitude)&0xf,pointer,space);        pointer += space>>4;    debug_cntr += space>>4;
+    space = adjust(2, compression_option,pointer,space);        pointer += space>>4;    debug_cntr += space>>4; //first two bits of compression option
+    space = adjust(1, srp_mode,pointer,space);                  pointer += space>>4;    debug_cntr += space>>4;
+    space = adjust(3,(sci_time>>32)&0x07,pointer,space);        pointer += space>>4;    debug_cntr += space>>4;
+    space = adjust(8,(sci_time>>24)&0xff,pointer,space);        pointer += space>>4;    debug_cntr += space>>4;
+    space = adjust(8,(sci_time>>16)&0xff,pointer,space);        pointer += space>>4;    debug_cntr += space>>4;
+    space = adjust(8,(sci_time>>8)&0xff,pointer,space);         pointer += space>>4;    debug_cntr += space>>4;
+    space = adjust(8,(sci_time)&0xff,pointer,space);            pointer += space>>4;    debug_cntr += space>>4;
+    space = adjust(4, (attitude)&0x0f,pointer,space);           pointer += space>>4;    debug_cntr += space>>4;
 
     if(srp_mode==0){
         if(beacon_at == 0){
-            space = adjust(1, 0,pointer,space);     pointer += space>>4;    debug_cntr += space>>4;
-            space = adjust(6, compress(scp_bin[44],3,3),pointer,space);     pointer += space>>4;    debug_cntr += space>>4;
-            space = adjust(7, compress(scp_bin[48],4,3),pointer,space);     pointer += space>>4;    debug_cntr += space>>4;
-            space = adjust(7, compress(scp_bin[49],4,3),pointer,space);     pointer += space>>4;    debug_cntr += space>>4;
-            space = adjust(7, compress(scp_bin[50],4,3),pointer,space);     pointer += space>>4;    debug_cntr += space>>4;
-            space = adjust(7, compress(scp_bin[51],4,3),pointer,space);     pointer += space>>4;    debug_cntr += space>>4;
-            space = adjust(6, compress(scp_bin[17],3,3),pointer,space);     pointer += space>>4;    debug_cntr += space>>4;
-            space = adjust(6, compress(scp_bin[23],3,3),pointer,space);     pointer += space>>4;    debug_cntr += space>>4;
+            space = adjust(1, 0,pointer,space);                                     pointer += space>>4;    debug_cntr += space>>4;
+            space = adjust(6, compress(scp_bin[44],3,3),pointer,space);             pointer += space>>4;    debug_cntr += space>>4;
+            space = adjust(7, compress(scp_bin[48],4,3),pointer,space);             pointer += space>>4;    debug_cntr += space>>4;
+            space = adjust(7, compress(scp_bin[49],4,3),pointer,space);             pointer += space>>4;    debug_cntr += space>>4;
+            space = adjust(7, compress(scp_bin[50],4,3),pointer,space);             pointer += space>>4;    debug_cntr += space>>4;
+            space = adjust(7, compress(scp_bin[51],4,3),pointer,space);             pointer += space>>4;    debug_cntr += space>>4;
+            space = adjust(6, compress(scp_bin[17],3,3),pointer,space);             pointer += space>>4;    debug_cntr += space>>4;
+            space = adjust(6, compress(scp_bin[23],3,3),pointer,space);             pointer += space>>4;    debug_cntr += space>>4;
             space = adjust(4, compress(proton_scp_sum ,10,2)>>8,pointer,space);     pointer += space>>4;    debug_cntr += space>>4;
             space = adjust(8, compress(proton_scp_sum ,10,2),pointer,space);        pointer += space>>4;    debug_cntr += space>>4;
-            space = adjust(4, compress(electron_scp_sum ,10,2)>>8,pointer,space);       pointer += space>>4;    debug_cntr += space>>4;
+            space = adjust(4, compress(electron_scp_sum ,10,2)>>8,pointer,space);   pointer += space>>4;    debug_cntr += space>>4;
             space = adjust(8, compress(electron_scp_sum ,10,2),pointer,space);      pointer += space>>4;    debug_cntr += space>>4;
             pointer = pointer + 1;
             for(int temp_i = 12; temp_i<14; temp_i++)
@@ -605,8 +609,8 @@
         }
     }else if(srp_mode==1){
         if(beacon_at==0){
-            space = adjust(1, 0,pointer,space);     pointer += space>>4;    debug_cntr += space>>4;
-            space = adjust(6, compress(0,3,3),pointer,space);     pointer += space>>4;    debug_cntr += space>>4;
+            space = adjust(1, 0,pointer,space);                             pointer += space>>4;    debug_cntr += space>>4;
+            space = adjust(6, compress(0,3,3),pointer,space);               pointer += space>>4;    debug_cntr += space>>4;
             space = adjust(7, compress(sfp_bin[48],4,3),pointer,space);     pointer += space>>4;    debug_cntr += space>>4;
             space = adjust(7, compress(sfp_bin[49],4,3),pointer,space);     pointer += space>>4;    debug_cntr += space>>4;
             space = adjust(7, compress(sfp_bin[50],4,3),pointer,space);     pointer += space>>4;    debug_cntr += space>>4;
@@ -619,9 +623,9 @@
             }
         }
         else if(beacon_at==1){
-            space = adjust(1, 1,pointer,space);     pointer += space>>4;        debug_cntr += space>>4;
-            space = adjust(1, compress(0,6,3)>>8,pointer,space);      pointer += space>>4;    debug_cntr += space>>4;             
-            space = adjust(8, compress(0,6,3),pointer,space);         pointer += space>>4;    debug_cntr += space>>4;
+            space = adjust(1, 1,pointer,space);                                 pointer += space>>4;    debug_cntr += space>>4;
+            space = adjust(1, compress(0,6,3)>>8,pointer,space);                pointer += space>>4;    debug_cntr += space>>4;             
+            space = adjust(8, compress(0,6,3),pointer,space);                   pointer += space>>4;    debug_cntr += space>>4;
             space = adjust(4, compress(sfp_bin[48],9,3)>>8,pointer,space);      pointer += space>>4;    debug_cntr += space>>4;             
             space = adjust(8, compress(sfp_bin[48],9,3),pointer,space);         pointer += space>>4;    debug_cntr += space>>4;
             space = adjust(4, compress(sfp_bin[49],9,3)>>8,pointer,space);      pointer += space>>4;    debug_cntr += space>>4;             
diff -r ae588e75cfa4 -r 783c248a6207 main.cpp
--- a/main.cpp	Fri Jul 15 14:59:27 2016 +0000
+++ b/main.cpp	Sat Jul 16 16:04:14 2016 +0000
@@ -133,10 +133,12 @@
     BAE_tc(tm_ptr);    
 }
 
+uint8_t test_srp[]= {
+                    
+                    };
 
 int main()
-{
-    
+{    
     CDMS_I2C_GPIO = 0; 
     PL_I2C_GPIO = 0; 
     
@@ -147,7 +149,7 @@
     gRX_COUNT = 0;
     RX1M.attach(&rx_read, Serial::RxIrq);
     
-    gPC.baud(115200);//changed for bypassing COM
+    gPC.baud(9600);//changed for bypassing COM
     
     // COMMON SPI
     spi.format(8,0);
@@ -176,28 +178,26 @@
     // COM_POWER_ON_TX();
     
     // COM_MNG_TMTC THREAD
-    gCOM_MNG_TMTC_THREAD = new Thread(COM_MNG_TMTC_FUN);
+    /*gCOM_MNG_TMTC_THREAD = new Thread(COM_MNG_TMTC_FUN);
     gCOM_MNG_TMTC_THREAD->set_priority(osPriorityHigh);
     
     gHK_THREAD = new Thread(FCTN_CDMS_HK_MAIN);
     gHK_THREAD->set_priority(osPriorityAboveNormal);
     
     gSCIENCE_THREAD = new Thread(SCIENCE_FUN);
-    gSCIENCE_THREAD->set_priority(osPriorityAboveNormal);
+    gSCIENCE_THREAD->set_priority(osPriorityAboveNormal);*/
     
     #if DEBUG
     gPC.puts("completed allocating threads\r\n");
-    #endif
-    
-    
+    #endif 
     
     master.frequency(400000);
     
-    HK_counter = new RtosTimer(hk_isr, osTimerPeriodic,(void * )NULL);
+    /*HK_counter = new RtosTimer(hk_isr, osTimerPeriodic,(void * )NULL);
     HK_counter->start(10000);
     
     sys_reset_cdms_timer = new RtosTimer(sys_pwr_reset, osTimerPeriodic, (void * )NULL);
-    sys_reset_cdms_timer->start(cdms_reset_timeout);
+    sys_reset_cdms_timer->start(cdms_reset_timeout);*/
 
     /*PL_wo_dma = new RtosTimer(payload_isr_fun_dma, osTimerPeriodic,(void * )NULL);
     PL_wo_dma->start(6000);*/