diff options
author | Vadim Yanitskiy <vyanitskiy@sysmocom.de> | 2021-01-08 02:30:43 +0100 |
---|---|---|
committer | Vadim Yanitskiy <vyanitskiy@sysmocom.de> | 2021-01-08 02:30:46 +0100 |
commit | e920902e25b0495889bc71f92fe9b8b8d53ce0f3 (patch) | |
tree | 53e01abaeb18e1ce4e69dea8a8b6f22192344bc2 | |
parent | power_control: generalize measurement pre-processing state (diff) | |
download | OsmoBTS-e920902e25b0495889bc71f92fe9b8b8d53ce0f3.tar.xz OsmoBTS-e920902e25b0495889bc71f92fe9b8b8d53ce0f3.zip |
power_control: properly track the first initial state
Change-Id: I16e7474b5affbd90855a2e407b305e9dec581dfa
Related: SYS#4918, SYS#4917
-rw-r--r-- | include/osmo-bts/gsm_data.h | 2 | ||||
-rw-r--r-- | src/common/power_control.c | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/include/osmo-bts/gsm_data.h b/include/osmo-bts/gsm_data.h index 253b115d..8071a28f 100644 --- a/include/osmo-bts/gsm_data.h +++ b/include/osmo-bts/gsm_data.h @@ -215,6 +215,8 @@ extern const struct gsm_power_ctrl_params power_ctrl_params_def; /* Measurement pre-processing state */ struct gsm_power_ctrl_meas_proc_state { + /* Number of measurements processed */ + unsigned int meas_num; /* Algorithm specific data */ union { struct { diff --git a/src/common/power_control.c b/src/common/power_control.c index 06296308..5e2e85e9 100644 --- a/src/common/power_control.c +++ b/src/common/power_control.c @@ -78,7 +78,7 @@ static int do_pf_ewma(const struct gsm_power_ctrl_meas_params *mp, int *Avg100 = &mps->ewma.Avg100; /* We don't have 'Avg[n - 1]' if this is the first run */ - if (*Avg100 == 0) { + if (mps->meas_num++ == 0) { *Avg100 = Val * EWMA_SCALE_FACTOR; return Val; } |