diff --git a/.hgsubstate b/.hgsubstate --- a/.hgsubstate +++ b/.hgsubstate @@ -1,2 +1,2 @@ 3081d1f9bb20b2b64a192585337a292a9804e0c5 LFR_basic-parameters -2450d4935652a4d0370245cc7fc60a4c51e6fc9b header/lfr_common_headers +c378fa14eadd80b3b873ca7c8f9f387893c07692 header/lfr_common_headers diff --git a/FSW-qt/fsw-qt.pro b/FSW-qt/fsw-qt.pro --- a/FSW-qt/fsw-qt.pro +++ b/FSW-qt/fsw-qt.pro @@ -20,7 +20,7 @@ SWVERSION=-1-0 DEFINES += SW_VERSION_N1=3 # major DEFINES += SW_VERSION_N2=1 # minor DEFINES += SW_VERSION_N3=0 # patch -DEFINES += SW_VERSION_N4=1 # internal +DEFINES += SW_VERSION_N4=2 # internal # #QMAKE_CFLAGS_RELEASE += -fprofile-arcs -ftest-coverage diff --git a/header/fsw_init.h b/header/fsw_init.h --- a/header/fsw_init.h +++ b/header/fsw_init.h @@ -30,7 +30,7 @@ extern float cp_rpw_sc_rw3_f1; extern float cp_rpw_sc_rw3_f2; extern float cp_rpw_sc_rw4_f1; extern float cp_rpw_sc_rw4_f2; -extern float sy_lfr_sc_rw_delta_f; +extern filterPar_t filterPar; // RTEMS TASKS rtems_task Init( rtems_task_argument argument); diff --git a/src/fsw_globals.c b/src/fsw_globals.c --- a/src/fsw_globals.c +++ b/src/fsw_globals.c @@ -90,7 +90,9 @@ float cp_rpw_sc_rw3_f1; float cp_rpw_sc_rw3_f2; float cp_rpw_sc_rw4_f1; float cp_rpw_sc_rw4_f2; -float sy_lfr_sc_rw_delta_f; + +// TC_LFR_LOAD_FILTER_PAR +filterPar_t filterPar; fbins_masks_t fbins_masks; unsigned int acquisitionDurations[3] = {ACQUISITION_DURATION_F0, ACQUISITION_DURATION_F1, ACQUISITION_DURATION_F2}; diff --git a/src/fsw_init.c b/src/fsw_init.c --- a/src/fsw_init.c +++ b/src/fsw_init.c @@ -169,7 +169,13 @@ rtems_task Init( rtems_task_argument ign cp_rpw_sc_rw3_f2 = 0.0; cp_rpw_sc_rw4_f1 = 0.0; cp_rpw_sc_rw4_f2 = 0.0; - sy_lfr_sc_rw_delta_f = 0.0; + // initialize filtering parameters + filterPar.spare_sy_lfr_pas_filter_enabled = DEFAULT_SY_LFR_PAS_FILTER_ENABLED; + filterPar.sy_lfr_pas_filter_modulus = DEFAULT_SY_LFR_PAS_FILTER_MODULUS; + filterPar.sy_lfr_pas_filter_tbad = DEFAULT_SY_LFR_PAS_FILTER_TBAD; + filterPar.sy_lfr_pas_filter_offset = DEFAULT_SY_LFR_PAS_FILTER_OFFSET; + filterPar.sy_lfr_pas_filter_shift = DEFAULT_SY_LFR_PAS_FILTER_SHIFT; + filterPar.sy_lfr_sc_rw_delta_f = DEFAULT_SY_LFR_SC_RW_DELTA_F; update_last_valid_transition_date( DEFAULT_LAST_VALID_TRANSITION_DATE ); // waveform picker initialization diff --git a/src/processing/fsw_processing.c b/src/processing/fsw_processing.c --- a/src/processing/fsw_processing.c +++ b/src/processing/fsw_processing.c @@ -716,30 +716,21 @@ unsigned char acquisitionTimeIsValid( un unsigned char pasFilteringIsEnabled; unsigned char ret; - pasFilteringIsEnabled = (parameter_dump_packet.spare_sy_lfr_pas_filter_enabled & 0x01); // [0000 0001] + pasFilteringIsEnabled = (filterPar.spare_sy_lfr_pas_filter_enabled & 0x01); // [0000 0001] ret = 1; - //*************************** - // - unsigned char sy_lfr_pas_filter_modulus = 4; - unsigned char sy_lfr_pas_filter_offset = 1; - float sy_lfr_pas_filter_shift = 0.5; - float sy_lfr_pas_filter_tbad = 1.0; - // - //**************************** - // compute acquisition time from caoarseTime and fineTime acquisitionTime = ( ((u_int64_t)coarseTime) << 16 ) + (u_int64_t) fineTime; // compute the timecode reference - timecodeReference = (u_int64_t) (floor( ((double) coarseTime) / ((double) sy_lfr_pas_filter_modulus) ) - * ((double) sy_lfr_pas_filter_modulus)) * 65536; + timecodeReference = (u_int64_t) (floor( ((double) coarseTime) / ((double) filterPar.sy_lfr_pas_filter_modulus) ) + * ((double) filterPar.sy_lfr_pas_filter_modulus)) * 65536; // compute the acquitionTime range - offsetInFineTime = ((double) sy_lfr_pas_filter_offset) * 65536; - shiftInFineTime = ((double) sy_lfr_pas_filter_shift) * 65536; - tBadInFineTime = ((double) sy_lfr_pas_filter_tbad) * 65536; + offsetInFineTime = ((double) filterPar.sy_lfr_pas_filter_offset) * 65536; + shiftInFineTime = ((double) filterPar.sy_lfr_pas_filter_shift) * 65536; + tBadInFineTime = ((double) filterPar.sy_lfr_pas_filter_tbad) * 65536; acquisitionTimeRangeMin = timecodeReference diff --git a/src/tc_load_dump_parameters.c b/src/tc_load_dump_parameters.c --- a/src/tc_load_dump_parameters.c +++ b/src/tc_load_dump_parameters.c @@ -343,9 +343,25 @@ int action_load_filter_par(ccsdsTelecomm parameter_dump_packet.sy_lfr_sc_rw_delta_f[2] = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_SC_RW_DELTA_F + 2 ]; parameter_dump_packet.sy_lfr_sc_rw_delta_f[3] = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_SC_RW_DELTA_F + 3 ]; + //**************************** + // store PAS filter parameters + // sy_lfr_pas_filter_enabled + filterPar.spare_sy_lfr_pas_filter_enabled = parameter_dump_packet.spare_sy_lfr_pas_filter_enabled; + // sy_lfr_pas_filter_modulus + filterPar.sy_lfr_pas_filter_modulus = parameter_dump_packet.sy_lfr_pas_filter_modulus; + // sy_lfr_pas_filter_tbad + copyFloatByChar( (unsigned char*) &filterPar.sy_lfr_pas_filter_tbad, + parameter_dump_packet.sy_lfr_pas_filter_tbad ); + // sy_lfr_pas_filter_offset + filterPar.sy_lfr_pas_filter_offset = parameter_dump_packet.sy_lfr_pas_filter_offset; + // sy_lfr_pas_filter_shift + copyFloatByChar( (unsigned char*) &filterPar.sy_lfr_pas_filter_shift, + parameter_dump_packet.sy_lfr_pas_filter_shift ); + + //**************************************************** // store the parameter sy_lfr_sc_rw_delta_f as a float - copyFloatByChar( (unsigned char*) &sy_lfr_sc_rw_delta_f, - (unsigned char*) ¶meter_dump_packet.sy_lfr_sc_rw_delta_f[0] ); + copyFloatByChar( (unsigned char*) &filterPar.sy_lfr_sc_rw_delta_f, + parameter_dump_packet.sy_lfr_sc_rw_delta_f ); } return flag; @@ -967,8 +983,8 @@ void setFBinMask( unsigned char *fbins_m bin = 0; // compute the frequency range to filter [ rw_f - delta_f/2; rw_f + delta_f/2 ] - fmin = rw_f - sy_lfr_sc_rw_delta_f / 2.; - fMAX = rw_f + sy_lfr_sc_rw_delta_f / 2.; + fmin = rw_f - filterPar.sy_lfr_sc_rw_delta_f / 2.; + fMAX = rw_f + filterPar.sy_lfr_sc_rw_delta_f / 2.; // compute the index of the frequency bin immediately below fmin binBelow = (int) ( floor( ((double) fmin) / ((double) deltaFreq)) );