aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <vyanitskiy@sysmocom.de>2020-11-27 15:07:55 +0100
committerVadim Yanitskiy <vyanitskiy@sysmocom.de>2020-12-04 09:27:48 +0100
commit0e24ace2f1a6986f2d494b5f9bf2d9c6a16825dd (patch)
tree84b4a5a9dce5ca2187e18ee7e722231a168a8508
parentpower_control: generalize power control state structure (diff)
downloadOsmoBTS-0e24ace2f1a6986f2d494b5f9bf2d9c6a16825dd.tar.xz
OsmoBTS-0e24ace2f1a6986f2d494b5f9bf2d9c6a16825dd.zip
power_control: lchan_ul_pf_ewma(): do not use lchan->meas.res_nr
This would allow to pass only two pointers: - 'struct bts_power_ctrl_params', and - 'struct lchan_power_ctrl_state', and get rid of 'struct gsm_lchan' dependency. The later is exactly where all state variables are supposed to be kept. Change-Id: Idfefca30f4944bc722b4e9d8f1685eb77670a9db Related: SYS#4918
-rw-r--r--src/common/power_control.c2
-rw-r--r--tests/power/ms_power_loop_test.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/common/power_control.c b/src/common/power_control.c
index 3328167a..5dbf8ce5 100644
--- a/src/common/power_control.c
+++ b/src/common/power_control.c
@@ -82,7 +82,7 @@ static int8_t lchan_ul_pf_ewma(const struct gsm_bts *bts,
int *Avg100 = &lchan->ms_power_ctrl.avg100_rxlev_dbm;
/* We don't have 'Avg[n - 1]' if this is the first run */
- if (lchan->meas.res_nr == 0) {
+ if (*Avg100 == 0) {
*Avg100 = Pwr * EWMA_SCALE_FACTOR;
return Pwr;
}
diff --git a/tests/power/ms_power_loop_test.c b/tests/power/ms_power_loop_test.c
index 1abe532e..147c725e 100644
--- a/tests/power/ms_power_loop_test.c
+++ b/tests/power/ms_power_loop_test.c
@@ -191,7 +191,7 @@ static void test_pf_algo_ewma(void)
g_bts->ul_power_ctrl.pf.ewma.alpha = 70; /* 30% smoothing */
lchan->ms_power_ctrl.current = 15;
- lchan->meas.res_nr = 0;
+ lchan->ms_power_ctrl.avg100_rxlev_dbm = 0;
/* This is the first sample, the filter outputs it as-is */
apply_power_test(lchan, -50, 0, 15);