Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: FreescaleIAP SimpleDMA mbed-rtos mbed
Fork of CDMS_CODE by
Diff: Compression.h
- Revision:
- 99:efde3df6cd94
- Parent:
- 98:fd99ddc0e0a1
- Child:
- 100:484a687431cc
--- a/Compression.h Tue Jan 26 10:05:19 2016 +0000
+++ b/Compression.h Tue Jan 26 12:18:53 2016 +0000
@@ -55,9 +55,10 @@
unsigned char position_tm_frame[3] = {8,11,5} , position_tm_starting[3] = {8,11,5}; //{sc,sf-bt,sf-at}
unsigned char id; //sf = 0,sc-at = 1,sc-bt = 2;
unsigned char TM_interleave_data[512] , TM_convoluted_data[270] = {0};
-int proton_scp_sum,electron_scp_sum,length, temp_crc,attitude = 0,FSC_science = 0,debug_cntr = 0, size,space;
+int proton_scp_sum,electron_scp_sum,length, temp_crc,attitude = 0,FSC_science = 1,debug_cntr = 0, size,space;
unsigned char *ptr ,* pointer;
long long int sci_time = 0x221000000; //call some function and get the time or get in the starting, what ever akshay says
+int test_cntr = 0;
Convolution ConvObj;
void convolution (unsigned char * ptr){
@@ -279,7 +280,7 @@
if(id == 1){ //below thereshold
space = adjust(1,0,pointer,8);
space = adjust(4,3,pointer,space);
- //FSC_science = FCTN_SD_MNGR(3);
+ FSC_science = FCTN_SD_MNGR(3);
//gPC.printf("SID = 3, FSC = %02X\r\n", FSC_science);
frames[id][1] = (FSC_science>>24)&0xff;
frames[id][2] = (FSC_science>>16)&0xff;
@@ -293,7 +294,8 @@
}else if(id == 2){
space = adjust(1,0,pointer,8);
space = adjust(4,2,pointer,space);
- //FSC_science = FCTN_SD_MNGR(2);
+// FSC_science = FCTN_SD_MNGR(2);
+
//gPC.printf("SID = 2, FSC = %02X\r\n", FSC_science);
frames[id][1] = (FSC_science>>16)&0xff;
frames[id][2] = (FSC_science>>8)&0xff;
@@ -302,13 +304,22 @@
temp_crc = crc16_gen(frames[id],132);
frames[id][132] = temp_crc>>8;
frames[id][133] = temp_crc & 0xff;
+ /*if(test_cntr++ == 0){
+ gPC.puts("frame start\r\n");
+ for(int i = 0; i<134; i++){
+ gPC.printf("%02X",frames[id][i]);
+ }
+ gPC.puts("frame ends\r\n");
+ }*/
+ exor(frames[id]);
convolution(frames[id]);
interleave(TM_convoluted_data,TM_interleave_data);
interleave(TM_convoluted_data+ 135,TM_interleave_data + 144);
if(id == 1)
- /*SD_WRITE(TM_interleave_data,FSC_science,3)*/;
+ SD_WRITE(TM_interleave_data,FSC_science,3);
else if (id == 2)
- /*SD_WRITE(TM_interleave_data,FSC_science,2)*/;
+ SD_WRITE(TM_interleave_data,FSC_science,2);
+ FSC_science++; //remove this after testing
position_tm_frame[id] = position_tm_starting[id];
frames[id][6-id] = (length-1) - j; // first head pointer.
}
@@ -562,7 +573,7 @@
pointer = frames[id];
space = adjust(1,0,pointer,8);
space = adjust(4,1,pointer,space);
- //FSC_science = FCTN_SD_MNGR(1);
+ FSC_science = FCTN_SD_MNGR(1);
//gPC.printf("SID = 1, FSC = %02X\r\n", FSC_science);
frames[id][1] = (FSC_science>>16)&0xff;
frames[id][2] = (FSC_science>>8)&0xff;
@@ -573,10 +584,11 @@
temp_crc = crc16_gen(frames[id],132);
frames[id][132] = temp_crc>>8;
frames[id][133] = temp_crc & 0xff;
+ exor(frames[id]);
convolution(frames[id]);
interleave(TM_convoluted_data,TM_interleave_data);
interleave(TM_convoluted_data+ 135,TM_interleave_data + 144);
- /*SD_WRITE(TM_interleave_data,FSC_science,1);*/
+ SD_WRITE(TM_interleave_data,FSC_science,1);
position_tm_frame[id] = position_tm_starting[id];
frames[id][4] = (length-1) - j;
}
