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 eeprom mbed-rtos mbed
Fork of CDMS_QM_03MAR2017_Flash_with_obsrs by
Diff: Compression.h
- Revision:
- 290:3159ff1081a2
- Parent:
- 278:1d837d6dfb6e
- Child:
- 295:699801854b71
--- a/Compression.h Sat Aug 06 06:34:38 2016 +0000
+++ b/Compression.h Sun Aug 07 10:36:59 2016 +0000
@@ -16,9 +16,30 @@
//reading functions 2byte, 4byte
#define srpz 0
#define scpz 0
-#define scp_last 0
-#define srp_last 0
+#define scpz_last 0
+#define srpz_last 0
+#define debug_fsc 0
+#define debug_time 0
+#define debug_dma 0
+#if debug_dma
+uint16_t read_2byte(uint8_t* ptr)
+{
+ uint16_t output = (((uint16_t )(*(ptr+1)))<<8);
+ output += (((uint16_t)(*ptr)));
+ return output;
+}
+
+uint32_t read_4byte(uint8_t* ptr)
+{
+ uint32_t output = (uint32_t)(*(ptr+3))<<24;
+ output += (uint32_t)(*(ptr+2)<<16);
+ output += (uint32_t)(*(ptr+1)<<8);
+ output += (uint32_t)(*(ptr));
+ return output;
+}
+#endif
+#if !debug_dma
uint16_t read_2byte(uint8_t* ptr)
{
uint16_t output = (uint8_t ) *(ptr+1);
@@ -34,7 +55,7 @@
output += (uint32_t)(*(ptr)<<24);
return output;
}
-
+#endif
uint8_t adjust(uint8_t size, uint8_t data, uint8_t* ptr , uint8_t space)
{
space = space&0x0f;
@@ -96,6 +117,11 @@
uint32_t attitude = 0;
uint32_t beacon_threshold[9] = {114688,245760,245760,245760,245760,114688,114688,65472,65472};
+/*----------------------------temporary counters used for testing purposes---------------------------*/
+uint32_t test_fsc[4]={1,1,1,1};
+/*---------------------------------------------------------------------------------------------------*/
+
+
Convolution ConvObj;
void convolution (uint8_t * ptr){
ConvObj.convolutionEncode(ptr, TM_convoluted_data);
@@ -106,9 +132,12 @@
void srp(uint8_t * head)
{
uint8_t sd_stat = 0;
- gPC.printf("\n\rEntered srp function");
+ gPC.printf("\n\rEntered SRP function");
debug_cntr = 0;
sci_time = FCTN_CDMS_RD_RTC();
+ #if debug_time
+ sci_time = 0x0000000021000000;
+ #endif
if(time_prev_scp==0){
time_prev_scp = sci_time;
}
@@ -122,14 +151,14 @@
for(uint8_t counter = 0 ; counter < 60 ; counter++)
{
#if srpz
- //gPC.printf("\n\n\rSRP count:%d",counter+1);
+ gPC.printf("\n\n\rSRP count:%d",counter+1);
#endif
/*-------------------- ------------populating sfp_bin and scp_bin[] starts here(also tag AT or BT)-----------------------*/
at = 0; pzf = 1; ezf = 1;
if(srp_mode == 0) //calibrated mode
{
#if srpz
- //gPC.printf("\n\rSRP - Calibrated Mode");
+ gPC.printf("\n\rSRP - Calibrated Mode");
#endif
for(int i=0; i<48 ; i++) //first 48 bins or SRP are of 16 bits size
{
@@ -164,7 +193,7 @@
else if(srp_mode == 1) //scattered mode
{
#if srpz
- //gPC.printf("\n\rSRP - Scatter Plot Mode");
+ gPC.printf("\n\rSRP - Scatter Plot Mode");
#endif
for(int i = 0; i <48; i++) //first 48 bins of SRP are of 16 bit size
{
@@ -178,7 +207,6 @@
}
for(int i = 0; i < 4 ; i++) //next 4 bins are of 32 bit size
{
- ///sfp_bin[i+48] = read_4byte( (ptr+64) + 4*i );
sfp_bin[i+48] = read_4byte( (ptr+96) + 4*i );
scp_bin[i+48] += sfp_bin[i+48];
if(sfp_bin[i+48] > sfp_threshold_m1[i+48]){
@@ -201,7 +229,7 @@
if(at == 0)
{
#if srpz
- //gPC.printf("\n\rSFP Below Threshold");
+ gPC.printf("\n\rSFP Below Threshold");
#endif
pointer = sfp; debug_cntr = 0;
space = adjust(4, attitude,pointer,8); pointer += space>>4; debug_cntr += space>>4;
@@ -241,7 +269,7 @@
} //below thershold ends here.
if(at == 1){
#if srpz
- //gPC.printf("\n\rSFP Above Threshold");
+ gPC.printf("\n\rSFP Above Threshold");
#endif
pointer = sfp + 6; debug_cntr = 6;space = 8;
sfp[0] = (sci_time>>27)&0xff; sfp[1] = (sci_time>>19)&0xff; sfp[2] = (sci_time>>11)&0xff; sfp[3] = (sci_time>>3)&0xff;
@@ -271,7 +299,7 @@
if(pzf == 0){
//cout<<"proton bins ";
#if srpz
- //gPC.printf("\n\rProton bins present in SRP");
+ gPC.printf("\n\rProton bins present in SRP");
#endif
for(uint8_t i = 0; i<17 ; i++){
space = adjust(2, ((compress(sfp_bin[i],8,2))>>8) ,pointer,space); pointer += space>>4; debug_cntr += space>>4;
@@ -282,7 +310,7 @@
if(ezf == 0){
//cout<<"electron bins ";
#if srpz
- //gPC.printf("\n\rElectron bins present in SRP");
+ gPC.printf("\n\rElectron bins present in SRP");
#endif
for(int i = 0; i<5 ; i++){
space = adjust(2,((compress(sfp_bin[18+i],8,2))>>8),pointer,space); pointer += space>>4; debug_cntr += space>>4;
@@ -313,7 +341,7 @@
if(at == 0)
{
#if srpz
- //gPC.printf("\n\rSFP below threshold");
+ gPC.printf("\n\rSFP below threshold");
#endif
pointer = sfp; debug_cntr = 0; space = 8;
space = adjust(4, attitude,pointer,8); pointer += space>>4; debug_cntr += space>>4;
@@ -333,7 +361,7 @@
{
#if srpz
- //gPC.printf("\n\rSFP below threshold");
+ gPC.printf("\n\rSFP below threshold");
#endif
pointer = sfp; debug_cntr = 0; space = 8;
space = adjust(3, sci_time>>32 ,pointer,space); pointer += space>>4; debug_cntr += space>>4;
@@ -366,7 +394,7 @@
}
length = (length%8==0)?(length/8):(length/8)+1; //converting length to mulitple of 8
#if srpz
- //gPC.printf("\n\rLength of SFP packet in bytes = %d",length);
+ gPC.printf("\n\rLength of SFP packet in bytes = %d",length);
#endif
/*----------------------------------------forming a science packet ends here-----------------------------------------------*/
@@ -374,7 +402,7 @@
if(id==1){
if(position_tm_frame[id]>130){
#if srpz
- //gPC.printf("\n\rSkipping the current frame.Inserting sfp packet into the next frame.");
+ gPC.printf("\n\rSkipping the current frame.Inserting sfp packet into the next frame.");
#endif
while(position_tm_frame[id]<132){
frames[id][position_tm_frame[id]] = 0;
@@ -385,7 +413,7 @@
else if(id==2){
if(position_tm_frame[id]>126){
#if srpz
- //gPC.printf("\n\rSkipping the current frame.Inserting sfp packet into the next frame.");
+ gPC.printf("\n\rSkipping the current frame.Inserting sfp packet into the next frame.");
#endif
while(position_tm_frame[id]<132){
frames[id][position_tm_frame[id]] = 0;
@@ -401,7 +429,7 @@
if(position_tm_frame[id]==frames[id][6-id]){
if(id==1){
#if srpz
- //gPC.printf("\n\rAdding Time to TM frame");
+ gPC.printf("\n\rAdding Time to TM frame");
#endif
frames[id][6] = (uint8_t)((sci_time>>32)&0x07);
frames[id][7] = (uint8_t)((sci_time>>24)&0xff);
@@ -419,30 +447,48 @@
{
/*-----------the current frame is completely filled and we fill frame header to write into SD card---------*/
#if srpz
- //gPC.printf("\n\rSFP_TM frame full. Length of current packet = %d",j);
- //gPC.printf("\n\rFrame Header: %d",frames[id][6-id]);
- //gPC.printf("\n\rFirst head pointer contents: 0x%02X",frames[id][frames[id][6-id]]);
+ gPC.printf("\n\rSFP_TM frame full. Length of current packet = %d",j);
+ gPC.printf("\n\rFirst Header pointer: %d",frames[id][6-id]);
+ gPC.printf("\n\rFirst head pointer contents: 0x%02X",frames[id][frames[id][6-id]]);
#endif
pointer = frames[id];
if(id == 1){ //below threshold
space = adjust(1,0,pointer,8);
space = adjust(4,3,pointer,space);
FSC_science = FSC_CURRENT[3]; ///to be used as this, but FSC_CURRENT[] is 32 bit
- gPC.printf("3 = 0x%X",FSC_science);
+
+ //gPC.printf("3 = 0x%X",FSC_science);
+ #if debug_fsc
+ frames[id][1] = (test_fsc[3]>>24)&0xff;
+ frames[id][2] = (test_fsc[3]>>16)&0xff;
+ frames[id][3] = (test_fsc[3]>>8)&0xff;
+ frames[id][4] = test_fsc[3]&0xff;
+ test_fsc[3]++;
+ #endif
+ #if !debug_fsc
frames[id][1] = (FSC_science>>24)&0xff;
frames[id][2] = (FSC_science>>16)&0xff;
frames[id][3] = (FSC_science>>8)&0xff;
frames[id][4] = FSC_science&0xff;
+ #endif
}
else if(id == 2) //above threshold
{
space = adjust(1,0,pointer,8);
space = adjust(4,2,pointer,space);
FSC_science = FSC_CURRENT[2]; ///to be used as this
- gPC.printf("2 = 0x%X",FSC_science);
+ //gPC.printf("2 = 0x%X",FSC_science);
+ #if debug_fsc
+ frames[id][1] = (test_fsc[2]>>16)&0xff;
+ frames[id][2] = (test_fsc[2]>>8)&0xff;
+ frames[id][3] = test_fsc[2]&0xff;
+ test_fsc[2]++;
+ #endif
+ #if !debug_fsc
frames[id][1] = (FSC_science>>16)&0xff;
frames[id][2] = (FSC_science>>8)&0xff;
frames[id][3] = FSC_science&0xff;
+ #endif
}
temp_crc = crc16_gen(frames[id],132);
frames[id][132] = temp_crc>>8;
@@ -450,8 +496,9 @@
#if srpz
gPC.printf("\n\rPrinting SFP_TM\n\r{");
+ //gPC.printf("\n\r{");
for(uint8_t z=0;z<134;z++){
- gPC.printf("0x%02X,",frames[id][z]);
+ gPC.printf("%02X",frames[id][z]);
}
gPC.printf("}\n\r");
#endif
@@ -472,7 +519,7 @@
if(sd_stat)
{
gPC.puts("sd write fail");
- }
+ }
position_tm_frame[id] = position_tm_starting[id];
frames[id][6-id] = (length - j)+position_tm_starting[id];
}
@@ -493,29 +540,48 @@
space = adjust(1,0,pointer,8);
space = adjust(4,3,pointer,space);
FSC_science = FSC_CURRENT[3]; ///to be used as this, but FSC_CURRENT[] is 32 bit
+ #if debug_fsc
+ frames[id][1] = (FSC_science>>24)&0xff;
+ frames[id][2] = (FSC_science>>16)&0xff;
+ frames[id][3] = (FSC_science>>8)&0xff;
+ frames[id][4] = FSC_science&0xff;
+ test_fsc[3]++;
+ #endif
+ #if !debug_fsc
frames[id][1] = (FSC_science>>24)&0xff;
frames[id][2] = (FSC_science>>16)&0xff;
frames[id][3] = (FSC_science>>8)&0xff;
frames[id][4] = FSC_science&0xff;
+ #endif
}
else if(id == 2) //above threshold
{
space = adjust(1,0,pointer,8);
space = adjust(4,2,pointer,space);
FSC_science = FSC_CURRENT[2]; ///to be used as this
+ #if debug_fsc
+ frames[id][1] = (test_fsc[2]>>16)&0xff;
+ frames[id][2] = (test_fsc[2]>>8)&0xff;
+ frames[id][3] = test_fsc[2]&0xff;
+ test_fsc[2]++;
+ #endif
+ #if !debug_fsc
frames[id][1] = (FSC_science>>16)&0xff;
frames[id][2] = (FSC_science>>8)&0xff;
frames[id][3] = FSC_science&0xff;
+ #endif
}
temp_crc = crc16_gen(frames[id],132);
frames[id][132] = temp_crc>>8;
frames[id][133] = temp_crc & 0xff;
- gPC.printf("\n\rPrinting SFP_TM\n\r{");
+ //gPC.printf("\n\rPrinting SFP_TM\n\r{");
+ gPC.printf("\n\r{");
for(uint8_t z=0;z<134;z++){
- gPC.printf("0x%02X,",frames[id][z]);
+ gPC.printf("%02X",frames[id][z]);
}
gPC.printf("}\n\r");
+ position_tm_frame[id] = position_tm_starting[id];
}
#endif
at = 0; pzf = 1; ezf = 1;
@@ -774,7 +840,7 @@
beacon_cntr++;
/*--------------------------------------------------beacon packet ends here--------------------------------------------------------*/
- //gPC.printf("\n\rSCP count: %d");
+ //gPC.printf("\n\n\rSCP");
uint8_t packet_pp,time_diff;
/*------------------------------------------Forming a science packet(scp) starts here----------------------------------------------*/
@@ -809,13 +875,13 @@
}
if(srp_mode == 0 && compression_option == 0){ //normal callibrated mode
#if scpz
- //gPC.printf("\n\rSCP - Normal calibrated mode");
+ gPC.printf("\n\rSCP - Normal calibrated mode");
#endif
space = adjust(1, pzf,pointer,space); pointer += space>>4; debug_cntr += space>>4;
space = adjust(1, ezf,pointer,space); pointer += space>>4; debug_cntr += space>>4;
if(at == 0 ){
#if scpz
- //gPC.printf("\n\rBelow threshold");
+ gPC.printf("\n\rBelow threshold");
#endif
for(int i = 0; i<8 ;i++){
space = adjust(7,compress(scp_bin[24+i],4,3) ,pointer,space); pointer += space>>4; debug_cntr += space>>4;
@@ -849,7 +915,7 @@
}// below threshold ends here
if(at == 1){
#if scpz
- //gPC.printf("\n\rAbove threshold");
+ gPC.printf("\n\rAbove threshold");
#endif
for(int i = 0; i<8 ;i++){
space = adjust(7,compress(scp_bin[24+i],4,3) ,pointer,space); pointer += space>>4; debug_cntr += space>>4;
@@ -884,11 +950,11 @@
} //srp_mode == 0 ends
if(srp_mode == 1){
#if scpz
- //gPC.printf("\n\rSCP - Scatter plot mode");
+ gPC.printf("\n\rSCP - Scatter plot mode");
#endif
if(at == 0){
#if scpz
- //gPC.printf("\n\rBelow Threshold");
+ gPC.printf("\n\rBelow Threshold");
#endif
for(int i=0; i<48; i++){
space = adjust(6, ((compress(scp_bin[i],3,3))&0xff) ,pointer,space); pointer += space>>4; debug_cntr += space>>4;
@@ -899,7 +965,7 @@
}
if(at == 1){
#if scpz
- //gPC.printf("\n\rAbove threshold");
+ gPC.printf("\n\rAbove threshold");
#endif
for(int i=0; i<48; i++){
space = adjust(7, (compress((scp_bin[i]/2),4,3))>>8 ,pointer,space); pointer += space>>4; debug_cntr += space>>4;
@@ -912,13 +978,13 @@
}// scp mode 1 end
if( srp_mode == 0 && compression_option == 1 ){ //scp data conservation mode
#if scpz
- //gPC.printf("\n\rSCP - Calibrated data conservation mode");
+ gPC.printf("\n\rSCP - Calibrated data conservation mode");
#endif
space = adjust(1, pzf,pointer,space); pointer += space>>4; debug_cntr += space>>4;
space = adjust(1, ezf,pointer,space); pointer += space>>4; debug_cntr += space>>4;
if(at == 0){
#if scpz
- //gPC.printf("\n\rBelow threshold");
+ gPC.printf("\n\rBelow threshold");
#endif
space = adjust(6, (compress(scp_bin[44],3,3)) ,pointer,space); pointer += space>>4; debug_cntr += space>>4;
for(int i=0; i<4; i++){
@@ -936,7 +1002,7 @@
}
}else if(at == 1){
#if scpz
- //gPC.printf("\n\rAbove threshold");
+ gPC.printf("\n\rAbove threshold");
#endif
space = adjust(1, (compress(scp_bin[44],6,3))>>8 ,pointer,space); pointer += space>>4; debug_cntr += space>>4;
space = adjust(8, (compress(scp_bin[44],6,3)) ,pointer,space); pointer += space>>4; debug_cntr += space>>4;
@@ -963,13 +1029,13 @@
if(srp_mode==0)
{
#if scpz
- //gPC.printf("\n\rSCP - calibrated extreme data conservation mode");
+ gPC.printf("\n\rSCP - calibrated extreme data conservation mode");
#endif
space = adjust(1, pzf,pointer,space); pointer += space>>4; debug_cntr += space>>4;
space = adjust(1, ezf,pointer,space); pointer += space>>4; debug_cntr += space>>4;
if(at==0){
#if scpz
- //gPC.printf("\n\rBelow threshold");
+ gPC.printf("\n\rBelow threshold");
#endif
space = adjust(7, (compress(scp_bin[50],4,3)) ,pointer,space); pointer += space>>4; debug_cntr += space>>4;
if(pzf==0){
@@ -982,7 +1048,7 @@
}
}else if(at==1){
#if scpz
- //gPC.printf("\n\rAbove threshold");
+ gPC.printf("\n\rAbove threshold");
#endif
space = adjust(4, (compress(scp_bin[50],9,3))>>8 ,pointer,space); pointer += space>>4; debug_cntr += space>>4;
space = adjust(8, (compress(scp_bin[50],9,3)) ,pointer,space); pointer += space>>4; debug_cntr += space>>4;
@@ -999,14 +1065,14 @@
else if(srp_mode==1)
{
#if scpz
- //gPC.printf("\n\rSCP - Scatter plot, extreme data conservation mode");
+ gPC.printf("\n\rSCP - Scatter plot, extreme data conservation mode");
#endif
pzf = 0; ezf = 0; //because proton energy bins are not available in scatter plot mode and hence in the packet we send dummy data(which is nothng but the maximum value which fits into that particular compression scheme)
space = adjust(1, pzf,pointer,space); pointer += space>>4; debug_cntr += space>>4;
space = adjust(1, ezf,pointer,space); pointer += space>>4; debug_cntr += space>>4;
if(at==0){
#if scpz
- //gPC.printf("\n\rBelow threshold");
+ gPC.printf("\n\rBelow threshold");
#endif
space = adjust(7, (compress(scp_bin[50],4,3)) ,pointer,space); pointer += space>>4; debug_cntr += space>>4;
// below 4 lines - filling the proton ane electron energy bins with zeros(junk value) since they're not available in srp
@@ -1017,7 +1083,7 @@
}
else if(at==1){
#if scpz
- //gPC.printf("\n\rAbove threshold");
+ gPC.printf("\n\rAbove threshold");
#endif
space = adjust(4, (compress(scp_bin[50],9,3))>>8 ,pointer,space); pointer += space>>4; debug_cntr += space>>4;
space = adjust(8, (compress(scp_bin[50],9,3)) ,pointer,space); pointer += space>>4; debug_cntr += space>>4;
@@ -1084,12 +1150,12 @@
}
length = (length%8==0)?(length/8):(length/8)+1;
#if scpz
- //gPC.printf("\n\rSCP packet length = %d",length);
+ gPC.printf("\n\rSCP packet length = %d",length);
#endif
if(position_tm_frame[id]>129){
#if scpz
- //gPC.printf("\n\rSkipping the current TM frame. Inserting SCP into the next frame");
- //gPC.printf("\n\rposition_tm_frame = %d",position_tm_frame[id]);
+ gPC.printf("\n\rSkipping the current TM frame. Inserting SCP into the next frame");
+ gPC.printf("\n\rposition_tm_frame = %d",position_tm_frame[id]);
#endif
while(position_tm_frame[id]<132){
frames[id][position_tm_frame[id]] = 0;
@@ -1103,7 +1169,7 @@
{
if(position_tm_frame[id]==frames[id][4]){
#if scpz
- //gPC.printf("\n\rInserting Time into SCP_TM");
+ gPC.printf("\n\rInserting Time into SCP_TM");
#endif
frames[id][5] = (uint8_t)((sci_time>>29)&0x3f);
frames[id][6] = (uint8_t)((sci_time>>21)&0xff);
@@ -1117,24 +1183,35 @@
if(position_tm_frame[id] == 132) //space full in the frame bro
{
#if scpz
- //gPC.printf("\n\rSCP_TM frame full. Length of current SCP packet = %d",j);
+ gPC.printf("\n\rSCP_TM frame full. Length of current SCP packet = %d",j);
#endif
pointer = frames[id];
space = adjust(1,0,pointer,8);
space = adjust(4,1,pointer,space);
FSC_science = FSC_CURRENT[1];
- gPC.printf("1 = 0x%X",FSC_science);
+ //gPC.printf("1 = 0x%X",FSC_science);
+
+ #if debug_fsc
frames[id][1] = (FSC_science>>16)&0xff;
frames[id][2] = (FSC_science>>8)&0xff;
frames[id][3] = (FSC_science)&0xff;
+ test_fsc[1]++;
+ #endif
+ #if !debug_fsc
+ frames[id][1] = (FSC_science>>16)&0xff;
+ frames[id][2] = (FSC_science>>8)&0xff;
+ frames[id][3] = (FSC_science)&0xff;
+ #endif
+
temp_crc = crc16_gen(frames[id],132);
frames[id][132] = temp_crc>>8;
frames[id][133] = temp_crc & 0xff;
#if scpz
//gPC.printf("\n\rFirst head pointer contents: 0x%02X",frames[id][frames[id][4]]);
- gPC.printf("\n\rPrinting SCP_TM\n\r{");
+ //gPC.printf("\n\rPrinting SCP_TM\n\r{");
+ gPC.printf("\n\r{");
for(uint8_t z=0;z<134;z++){
- gPC.printf("0x%02X,",frames[id][z]);
+ gPC.printf("%02X",frames[id][z]);
}
gPC.printf("}\n\r");
#endif
@@ -1145,52 +1222,53 @@
sd_stat = SD_WRITE(TM_interleave_data,FSC_science+1,1); //sd_write returns ack, for now not included
if(sd_stat)
- {
- gPC.puts("sd write fail");
- }
-
+ {
+ gPC.puts("sd write fail");
+ }
position_tm_frame[id] = position_tm_starting[id];
frames[id][4] = (length - j)+position_tm_starting[id];
}
}
#if scpz_last
- //gPC.printf("\n\rPrinting the last SFP_TM frame");
+ //gPC.printf("\n\rPrinting the last SCP_TM frame");
//gPC.printf("\n\n\rPosition of tm_pointer: %d",position_tm_frame[id]);
while(position_tm_frame[id]<132){
frames[id][position_tm_frame[id]] = 0;
position_tm_frame[id]++;
}
- if(position_tm_frame[id]==132){
- //gPC.printf("\n\rFirst head pointer contents: 0x%02X",frames[id][frames[id][4]]);
+ if(position_tm_frame[id] == 132) //space full in the frame bro
+ {
+ //gPC.printf("\n\rSCP_TM frame full. Length of current SCP packet = %d",j);
pointer = frames[id];
- if(id == 1){ //below threshold
- space = adjust(1,0,pointer,8);
- space = adjust(4,3,pointer,space);
- FSC_science = FSC_CURRENT[1]; ///to be used as this, but FSC_CURRENT[] is 32 bit
- frames[id][1] = (FSC_science>>24)&0xff;
- frames[id][2] = (FSC_science>>16)&0xff;
- frames[id][3] = (FSC_science>>8)&0xff;
- frames[id][4] = FSC_science&0xff;
- }
- else if(id == 2) //above threshold
- {
- space = adjust(1,0,pointer,8);
- space = adjust(4,2,pointer,space);
- FSC_science = FSC_CURRENT[2]; ///to be used as this
- frames[id][1] = (FSC_science>>16)&0xff;
- frames[id][2] = (FSC_science>>8)&0xff;
- frames[id][3] = FSC_science&0xff;
- }
+ space = adjust(1,0,pointer,8);
+ space = adjust(4,1,pointer,space);
+ FSC_science = FSC_CURRENT[1];
+ //gPC.printf("1 = 0x%X",FSC_science);
+
+ #if debug_fsc
+ frames[id][1] = (FSC_science>>16)&0xff;
+ frames[id][2] = (FSC_science>>8)&0xff;
+ frames[id][3] = (FSC_science)&0xff;
+ test_fsc[1]++;
+ #endif
+ #if !debug_fsc
+ frames[id][1] = (FSC_science>>16)&0xff;
+ frames[id][2] = (FSC_science>>8)&0xff;
+ frames[id][3] = (FSC_science)&0xff;
+ #endif
+
temp_crc = crc16_gen(frames[id],132);
frames[id][132] = temp_crc>>8;
frames[id][133] = temp_crc & 0xff;
-
-
- gPC.printf("\n\rPrinting SCP_TM\n\r{");
+ //gPC.printf("\n\rFirst head pointer contents: 0x%02X",frames[id][frames[id][4]]);
+ //gPC.printf("\n\rPrinting SCP_TM\n\r{");
+ gPC.printf("\n\r{");
for(uint8_t z=0;z<134;z++){
- gPC.printf("0x%02X,",frames[id][z]);
+ gPC.printf("%02X",frames[id][z]);
}
gPC.printf("}\n\r");
+ position_tm_frame[id] = position_tm_starting[id];
}
- #endif
+ #endif
+ gPC.printf("\n\rExiting SRP");
}
\ No newline at end of file
