commit 0ac2f4fd8cbcfafc807fdef9808a7a396e3d808b parent 246440a01b9c160e2817102bd886924a570675f1 Author: mntmn <lukas@mntmn.com> Date: Thu, 2 Jul 2020 20:03:26 +0200 lpc: reduce discharge min cycles to 5; go directly from balancing to full Diffstat:
M | reform2-lpc-fw/src/boards/reform2/board_reform2.c | | | 12 | ++++++++++-- |
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/reform2-lpc-fw/src/boards/reform2/board_reform2.c b/reform2-lpc-fw/src/boards/reform2/board_reform2.c @@ -712,10 +712,18 @@ int main(void) discharge_overvolted_cells(); // discharge - if (cycles_in_state > 10 && (num_overvolted_cells==0 || num_undervolted_cells>0)) { + if (cycles_in_state > 5 && (num_overvolted_cells==0 || num_undervolted_cells>0)) { reset_discharge_bits(); - state = ST_CHARGE; cycles_in_state = 0; + + if (volts >= FULLY_CHARGED_VOLTAGE) { + // when transitioning to fully charged, we assume that we're at max capacity + capacity_accu_ampsecs = capacity_max_ampsecs; + state = ST_FULLY_CHARGED; + reached_full_charge = 1; + } else { + state = ST_CHARGE; + } } } else if (state == ST_MISSING) {