CDMS_CODE_samp_23SEP_DMA_flag
Dependencies: FreescaleIAP SimpleDMA mbed-rtos mbed
Fork of CDMS_CODE_samp_23SEP_DMA by
Diff: Compression.h
- Revision:
- 267:783c248a6207
- Parent:
- 266:ae588e75cfa4
- Child:
- 268:ded5306a1fd1
--- 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;