Discharging: use averaged values for thresholds
This commit is contained in:
parent
0339b521dd
commit
716c158716
|
@ -270,7 +270,7 @@ static void load_fsm_update(uint64_t uptime_ms, struct MeasurementResult *meas)
|
||||||
discharge_state = DISCHARGE_OVERCURRENT;
|
discharge_state = DISCHARGE_OVERCURRENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(meas->u_bat < u_bat_load_off) {
|
if(meas->avg_u_bat < u_bat_load_off) {
|
||||||
discharge_state = DISCHARGE_VOLTAGE_LOW;
|
discharge_state = DISCHARGE_VOLTAGE_LOW;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -282,7 +282,7 @@ static void load_fsm_update(uint64_t uptime_ms, struct MeasurementResult *meas)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Can only switch on again after a specific amount of time has passed
|
// Can only switch on again after a specific amount of time has passed
|
||||||
if((meas->u_bat > u_bat_load_on)
|
if((meas->avg_u_bat > u_bat_load_on)
|
||||||
&& (discharge_time_in_state > LOAD_ON_DELAY)) {
|
&& (discharge_time_in_state > LOAD_ON_DELAY)) {
|
||||||
discharge_state = DISCHARGE_OK;
|
discharge_state = DISCHARGE_OK;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue