# HG changeset patch # User paul # Date 2017-03-16 07:33:59 # Node ID 5d6b18a25367e68f0afb9256690cfb29d9c3b924 # Parent d301b368f8835d170260a7fa214c4f6912097a7d 3.2.0.3 Bug #972 Negative Parameters send into TC_LFR_LOAD_FILTER_PAR not rejected diff --git a/.hgsubstate b/.hgsubstate --- a/.hgsubstate +++ b/.hgsubstate @@ -1,2 +1,2 @@ 3081d1f9bb20b2b64a192585337a292a9804e0c5 LFR_basic-parameters -f97721719ddb7e088956d5fd3cffb0f9587a041b header/lfr_common_headers +e01ac8bd125a79a7af38b0e3ba0330f5be1a3c92 header/lfr_common_headers diff --git a/header/tc_load_dump_parameters.h b/header/tc_load_dump_parameters.h --- a/header/tc_load_dump_parameters.h +++ b/header/tc_load_dump_parameters.h @@ -103,6 +103,8 @@ void merge_fbins_masks( void ); int set_sy_lfr_fbins( ccsdsTelecommandPacket_t *TC ); // TC_LFR_LOAD_PARS_FILTER_PAR +int check_sy_lfr_rw_k( ccsdsTelecommandPacket_t *TC, int offset, int* pos, float* value ); +int check_all_sy_lfr_rw_k( ccsdsTelecommandPacket_t *TC, int *pos, float*value ); int check_sy_lfr_filter_parameters( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); // KCOEFFICIENTS diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -64,7 +64,7 @@ option(FSW_debug_tch "?" OFF) set(SW_VERSION_N1 "3" CACHE STRING "Choose N1 FSW Version." FORCE) set(SW_VERSION_N2 "2" CACHE STRING "Choose N2 FSW Version." FORCE) set(SW_VERSION_N3 "0" CACHE STRING "Choose N3 FSW Version." FORCE) -set(SW_VERSION_N4 "2" CACHE STRING "Choose N4 FSW Version." FORCE) +set(SW_VERSION_N4 "3" CACHE STRING "Choose N4 FSW Version." FORCE) if(FSW_verbose) add_definitions(-DPRINT_MESSAGES_ON_CONSOLE) 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 @@ -796,19 +796,6 @@ unsigned char acquisitionTimeIsValid( un } } -// printf("coarseTime = %x, fineTime = %x\n", -// coarseTime, -// fineTime); - -// printf("[ret = %d] *** acquisitionTime = %f, Reference = %f", -// ret, -// acquisitionTime / 65536., -// timecodeReference / 65536.); - -// printf(", Min = %f, Max = %f\n", -// acquisitionTimeRangeMin / 65536., -// acquisitionTimeRangeMax / 65536.); - return ret; } 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 @@ -1332,6 +1332,115 @@ int set_sy_lfr_fbins( ccsdsTelecommandPa //*************************** // TC_LFR_LOAD_PAS_FILTER_PAR +int check_sy_lfr_rw_k( ccsdsTelecommandPacket_t *TC, int offset, int* pos, float* value ) +{ + float rw_k; + int ret; + + ret = LFR_SUCCESSFUL; + rw_k = INIT_FLOAT; + + copyFloatByChar( (unsigned char*) &rw_k, (unsigned char*) &TC->dataAndCRC[ offset ] ); + + *pos = offset; + *value = rw_k; + + if (rw_k < MIN_SY_LFR_RW_K) + { + ret = WRONG_APP_DATA; + } + + return ret; +} + +int check_all_sy_lfr_rw_k( ccsdsTelecommandPacket_t *TC, int *pos, float*value ) +{ + int ret; + + ret = LFR_SUCCESSFUL; + + //**** + //**** + // RW1 + ret = check_sy_lfr_rw_k( TC, DATAFIELD_POS_SY_LFR_RW1_K1, pos, value ); // K1 + if (ret == LFR_SUCCESSFUL) // K2 + { + ret = check_sy_lfr_rw_k( TC, DATAFIELD_POS_SY_LFR_RW1_K2, pos, value ); + } + if (ret == LFR_SUCCESSFUL) // K3 + { + ret = check_sy_lfr_rw_k( TC, DATAFIELD_POS_SY_LFR_RW1_K3, pos, value ); + } + if (ret == LFR_SUCCESSFUL) // K4 + { + ret = check_sy_lfr_rw_k( TC, DATAFIELD_POS_SY_LFR_RW1_K4, pos, value ); + } + + //**** + //**** + // RW2 + if (ret == LFR_SUCCESSFUL) // K1 + { + ret = check_sy_lfr_rw_k( TC, DATAFIELD_POS_SY_LFR_RW2_K1, pos, value ); + } + if (ret == LFR_SUCCESSFUL) // K2 + { + ret = check_sy_lfr_rw_k( TC, DATAFIELD_POS_SY_LFR_RW2_K2, pos, value ); + } + if (ret == LFR_SUCCESSFUL) // K3 + { + ret = check_sy_lfr_rw_k( TC, DATAFIELD_POS_SY_LFR_RW2_K3, pos, value ); + } + if (ret == LFR_SUCCESSFUL) // K4 + { + ret = check_sy_lfr_rw_k( TC, DATAFIELD_POS_SY_LFR_RW2_K4, pos, value ); + } + + //**** + //**** + // RW3 + if (ret == LFR_SUCCESSFUL) // K1 + { + ret = check_sy_lfr_rw_k( TC, DATAFIELD_POS_SY_LFR_RW3_K1, pos, value ); + } + if (ret == LFR_SUCCESSFUL) // K2 + { + ret = check_sy_lfr_rw_k( TC, DATAFIELD_POS_SY_LFR_RW3_K2, pos, value ); + } + if (ret == LFR_SUCCESSFUL) // K3 + { + ret = check_sy_lfr_rw_k( TC, DATAFIELD_POS_SY_LFR_RW3_K3, pos, value ); + } + if (ret == LFR_SUCCESSFUL) // K4 + { + ret = check_sy_lfr_rw_k( TC, DATAFIELD_POS_SY_LFR_RW3_K4, pos, value ); + } + + //**** + //**** + // RW4 + if (ret == LFR_SUCCESSFUL) // K1 + { + ret = check_sy_lfr_rw_k( TC, DATAFIELD_POS_SY_LFR_RW4_K1, pos, value ); + } + if (ret == LFR_SUCCESSFUL) // K2 + { + ret = check_sy_lfr_rw_k( TC, DATAFIELD_POS_SY_LFR_RW4_K2, pos, value ); + } + if (ret == LFR_SUCCESSFUL) // K3 + { + ret = check_sy_lfr_rw_k( TC, DATAFIELD_POS_SY_LFR_RW4_K3, pos, value ); + } + if (ret == LFR_SUCCESSFUL) // K4 + { + ret = check_sy_lfr_rw_k( TC, DATAFIELD_POS_SY_LFR_RW4_K4, pos, value ); + } + + + + return ret; +} + int check_sy_lfr_filter_parameters( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ) { int flag; @@ -1344,12 +1453,19 @@ int check_sy_lfr_filter_parameters( ccsd float sy_lfr_pas_filter_shift; float sy_lfr_sc_rw_delta_f; char *parPtr; + int *datafield_pos; + float *rw_k; flag = LFR_SUCCESSFUL; sy_lfr_pas_filter_tbad = INIT_FLOAT; sy_lfr_pas_filter_shift = INIT_FLOAT; sy_lfr_sc_rw_delta_f = INIT_FLOAT; parPtr = NULL; + datafield_pos = NULL; + rw_k = NULL; + + *datafield_pos = LFR_DEFAULT_ALT; + *rw_k = INIT_FLOAT; //*************** // get parameters @@ -1429,7 +1545,26 @@ int check_sy_lfr_filter_parameters( ccsd //********************* // sy_lfr_sc_rw_delta_f - // nothing to check, no default value in the ICD + if (flag == LFR_SUCCESSFUL) + { + if ( sy_lfr_sc_rw_delta_f < MIN_SY_LFR_SC_RW_DELTA_F ) + { + status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_SC_RW_DELTA_F + DATAFIELD_OFFSET, sy_lfr_sc_rw_delta_f ); + flag = WRONG_APP_DATA; + } + } + + //************ + // sy_lfr_rw_k + if (flag == LFR_SUCCESSFUL) + { + flag = check_all_sy_lfr_rw_k( TC, datafield_pos, rw_k ); + if (flag != LFR_SUCCESSFUL) + { + status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, *datafield_pos + DATAFIELD_OFFSET, *rw_k ); + } + } + return flag; }