<p>pespin has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/osmo-bts/+/19703">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">common: tx_power: Fix bug in power ramp up below max-initial value<br><br>See previous commit adding the unit test about the error description and<br>expected behavior.<br><br>The wrong behavior appeared due to step_size_mdB being unsigned and the<br>whole addition at the left side of the comparison being turned too as<br>unsigned, hence a small negative value turning into a big positive<br>value, and tpp->p_total_cur_mdBm not being updated to speed up the power<br>ramping.<br><br>Change-Id: I36a34362ebc90226fd8e1e190f898c3718fd923a<br>---<br>M src/common/tx_power.c<br>M tests/tx_power/tx_power_test.ok<br>2 files changed, 1 insertion(+), 5 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/03/19703/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/common/tx_power.c b/src/common/tx_power.c</span><br><span>index c5ea7ed..08c4236 100644</span><br><span>--- a/src/common/tx_power.c</span><br><span>+++ b/src/common/tx_power.c</span><br><span>@@ -278,7 +278,7 @@</span><br><span>           } else {</span><br><span>                     /* We need to step it up. Start from the current value, shortcutting to max-initial. */</span><br><span>                      /* Set attenuation to cause no power change right now */</span><br><span style="color: hsl(0, 100%, 40%);">-                        if (tpp->p_total_cur_mdBm + tpp->ramp.step_size_mdB < tpp->ramp.max_initial_pout_mdBm)</span><br><span style="color: hsl(120, 100%, 40%);">+                    if (tpp->p_total_cur_mdBm + (int)tpp->ramp.step_size_mdB < tpp->ramp.max_initial_pout_mdBm)</span><br><span>                              tpp->p_total_cur_mdBm = tpp->ramp.max_initial_pout_mdBm - tpp->ramp.step_size_mdB;</span><br><span>                  tpp->ramp.attenuation_mdB = tpp->p_total_tgt_mdBm - tpp->p_total_cur_mdBm;</span><br><span> </span><br><span>diff --git a/tests/tx_power/tx_power_test.ok b/tests/tx_power/tx_power_test.ok</span><br><span>index ec3ea61..c8f0441 100644</span><br><span>--- a/tests/tx_power/tx_power_test.ok</span><br><span>+++ b/tests/tx_power/tx_power_test.ok</span><br><span>@@ -23,10 +23,6 @@</span><br><span> CHANGE_POWER(23000)</span><br><span> power_ramp finished</span><br><span> Testing tx_power ramping for osmo-bts-trx after lock</span><br><span style="color: hsl(0, 100%, 40%);">-CHANGE_POWER(-8000)</span><br><span style="color: hsl(0, 100%, 40%);">-CHANGE_POWER(-6000)</span><br><span style="color: hsl(0, 100%, 40%);">-CHANGE_POWER(-4000)</span><br><span style="color: hsl(0, 100%, 40%);">-CHANGE_POWER(-2000)</span><br><span> CHANGE_POWER(0)</span><br><span> CHANGE_POWER(2000)</span><br><span> CHANGE_POWER(4000)</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-bts/+/19703">change 19703</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/osmo-bts/+/19703"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-bts </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I36a34362ebc90226fd8e1e190f898c3718fd923a </div>
<div style="display:none"> Gerrit-Change-Number: 19703 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>