From 381aa7e248ede3c2d3f6c94052fb46eee1171a85 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Tue, 6 Jul 2021 04:29:00 +0200 Subject: adapt to order of interference boundaries Change-Id: I88d841d8d835bde8392c7b606b28c9070b7adc6e --- src/common/gsm_data.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/common/gsm_data.c b/src/common/gsm_data.c index 36a57115..a35b1cdf 100644 --- a/src/common/gsm_data.c +++ b/src/common/gsm_data.c @@ -311,9 +311,16 @@ int gsm_lchan_interf_meas_calc_band(struct gsm_lchan *lchan) meas_avg = meas_sum / (int) meas_num; /* Determine the band using interference boundaries from BSC */ - for (b = 0; b < ARRAY_SIZE(bts->interference.boundary); b++) { - if (meas_avg >= bts->interference.boundary[b]) - break; /* Current 'b' is the band value */ + if (bts->interference.boundary[0] > bts->interference.boundary[1]) { + for (b = 0; b < ARRAY_SIZE(bts->interference.boundary); b++) { + if (meas_avg >= bts->interference.boundary[b]) + break; /* Current 'b' is the band value */ + } + } else { + for (b = 0; b < ARRAY_SIZE(bts->interference.boundary); b++) { + if (meas_avg < bts->interference.boundary[b]) + break; /* Current 'b' is the band value */ + } } LOGPLCHAN(lchan, DL1C, LOGL_DEBUG, -- cgit v1.2.3