# HG changeset patch # User paul # Date 2017-03-28 12:59:33 # Node ID 3e73a8516099d75e46ffc37b65a5d693ade9e730 # Parent cae68a260aa21e2bfbe2826d3fc01a8ce2a1c474 3.2.0.11 filter updated in AVGV diff --git a/header/fsw_misc.h b/header/fsw_misc.h --- a/header/fsw_misc.h +++ b/header/fsw_misc.h @@ -66,29 +66,33 @@ typedef struct{ unsigned char dpu_spw_rx_too_big; } hk_lfr_me_t; -#define B00 23 -#define B01 23 +#define B00 65 +#define B01 65 #define B02 0 -#define B10 1024 -#define B11 -1771 -#define B12 1024 -#define B20 1024 -#define B21 -1937 -#define B22 1024 +#define B10 2048 +#define B11 -3817 +#define B12 2048 +#define B20 2048 +#define B21 -3987 +#define B22 2048 #define A00 1 -#define A01 -28324 +#define A01 -1850 #define A02 0 #define A10 1 -#define A11 -1828 -#define A12 822 +#define A11 -3787 +#define A12 1758 #define A20 1 -#define A21 -1956 -#define A22 950 +#define A21 -3974 +#define A22 1943 -#define G0 15 -#define G1 10 -#define G2 10 +#define GAIN_B0 17 +#define GAIN_B1 11 +#define GAIN_B2 11 + +#define GAIN_A0 11 +#define GAIN_A1 11 +#define GAIN_A2 11 #define NB_COEFFS 3 #define COEFF0 0 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 "10" CACHE STRING "Choose N4 FSW Version." FORCE) +set(SW_VERSION_N4 "11" CACHE STRING "Choose N4 FSW Version." FORCE) if(FSW_verbose) add_definitions(-DPRINT_MESSAGES_ON_CONSOLE) diff --git a/src/fsw_misc.c b/src/fsw_misc.c --- a/src/fsw_misc.c +++ b/src/fsw_misc.c @@ -351,9 +351,10 @@ int filter( int x, filter_ctx* ctx ) { static const int b[NB_COEFFS][NB_COEFFS]={ {B00, B01, B02}, {B10, B11, B12}, {B20, B21, B22} }; static const int a[NB_COEFFS][NB_COEFFS]={ {A00, A01, A02}, {A10, A11, A12}, {A20, A21, A22} }; - static const int g_pow2[NB_COEFFS]={G0, G1, G2}; + static const int b_gain[NB_COEFFS]={GAIN_B0, GAIN_B1, GAIN_B2}; + static const int a_gain[NB_COEFFS]={GAIN_A0, GAIN_A1, GAIN_A2}; - int W; + int_fast32_t W; int i; W = INIT_INT; @@ -362,15 +363,15 @@ int filter( int x, filter_ctx* ctx ) //Direct-Form-II for ( i = 0; i < NB_COEFFS; i++ ) { - x = x << g_pow2[ i ]; - W = ( x - ( a[i][COEFF1] * ctx->W[i][COEFF0] ) - - ( a[i][COEFF2] * ctx->W[i][COEFF1] ) ) >> g_pow2[ i ]; + x = x << a_gain[i]; + W = (x - ( a[i][COEFF1] * ctx->W[i][COEFF0] ) + - ( a[i][COEFF2] * ctx->W[i][COEFF1] ) ) >> a_gain[i]; x = ( b[i][COEFF0] * W ) + ( b[i][COEFF1] * ctx->W[i][COEFF0] ) + ( b[i][COEFF2] * ctx->W[i][COEFF1] ); - x =- ( x >> g_pow2[i] ); - ctx->W[i][COEFF1] = ctx->W[i][COEFF0]; - ctx->W[i][COEFF0] = W; + x = x >> b_gain[i]; + ctx->W[i][1] = ctx->W[i][0]; + ctx->W[i][0] = W; } return x; }