aboutsummaryrefslogtreecommitdiffstats
path: root/src/common
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2020-07-27 17:34:29 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2020-07-27 17:34:34 +0200
commit57fc9fa7821483dd9d3f7ca2c5fd1c8ce593d444 (patch)
tree9c4b9075f4e9c395065acec5f02e0388cd12b613 /src/common
parenteef420d1ca2144682d3de3f4e5cc4a7458276a03 (diff)
tx_power: Take into account max-initial when ramping up bigger power lvl intervals
Until now, power-ramp max-initial was only taken into account in order to skip ramping if the desired target level was below it, in order to forbid growin too quickly or applying directly to much power given power amplifier requirements. However, in the event that a higher tx power level is desired, max-initial was not taking into account and ramping simply started from current tx power level, which could be a lot lower than max-initial. Allow shortcutting the ramping in that case so that max-initial is applied directly, and ramping continues from there, in order to have a more expected behavior (max-initial applied the same). Since max-initial can since a few commits before handle a negative value, this means One can for instance set max-initial to -10 and still keep the old behavior of ramping step by step from -10 (rf-locked in osmo-bts-trx) to 0 or 7 or whatever is the nominal power (max_power_red). Change-Id: I4e5742ecdbf66d77ff9445999f6fff43bbf4856a
Diffstat (limited to 'src/common')
-rw-r--r--src/common/tx_power.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/common/tx_power.c b/src/common/tx_power.c
index 7f134ca3..c5ea7ed6 100644
--- a/src/common/tx_power.c
+++ b/src/common/tx_power.c
@@ -276,8 +276,10 @@ int power_ramp_start(struct gsm_bts_trx *trx, int p_total_tgt_mdBm, int bypass,
tpp->ramp.attenuation_mdB = 0;
power_ramp_timer_cb(trx);
} else {
- /* We need to step it up. Start from the current value */
+ /* We need to step it up. Start from the current value, shortcutting to max-initial. */
/* Set attenuation to cause no power change right now */
+ if (tpp->p_total_cur_mdBm + tpp->ramp.step_size_mdB < tpp->ramp.max_initial_pout_mdBm)
+ tpp->p_total_cur_mdBm = tpp->ramp.max_initial_pout_mdBm - tpp->ramp.step_size_mdB;
tpp->ramp.attenuation_mdB = tpp->p_total_tgt_mdBm - tpp->p_total_cur_mdBm;
/* start with the first step */