power_control: properly track the first initial state
Change-Id: I16e7474b5affbd90855a2e407b305e9dec581dfa Related: SYS#4918, SYS#4917
This commit is contained in:
parent
834ba05cd2
commit
e920902e25
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue