charge_control: implement voltage transition
This commit is contained in:
parent
49bd9247e0
commit
79fe1113de
|
@ -136,19 +136,28 @@ static void solar_fsm_update(uint64_t uptime_ms, struct MeasurementResult *meas)
|
|||
|
||||
case CHARGE_TRANSITION:
|
||||
// FIXME: dynamically adjust thresholds
|
||||
if(charge_time_in_state < INITIAL_TO_FLOAT_TRANSITION_TIME) {
|
||||
fxp_t u_bat_full =
|
||||
fxp_add(u_bat_initial_full,
|
||||
fxp_mult(
|
||||
fxp_sub(u_bat_float_full, u_bat_initial_full),
|
||||
fxp_div(charge_time_in_state, INITIAL_TO_FLOAT_TRANSITION_TIME)));
|
||||
|
||||
fxp_t u_bat_low = fxp_sub(u_bat_full, u_bat_regulation_corridor);
|
||||
|
||||
charge_state = control_solar_charging(
|
||||
u_bat_float_full,
|
||||
u_bat_float_low,
|
||||
u_bat_full,
|
||||
u_bat_low,
|
||||
uptime_ms,
|
||||
meas,
|
||||
charge_state,
|
||||
charge_time_in_state);
|
||||
|
||||
// time limit for transition to float charging
|
||||
if(charge_time_in_state > INITIAL_TO_FLOAT_TRANSITION_TIME) {
|
||||
} else {
|
||||
// time limit for transition to float charging reached
|
||||
charge_state = CHARGE_FLOAT;
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case CHARGE_FLOAT:
|
||||
|
|
Loading…
Reference in a new issue