commit c83ba360be7e45849429e16721de8a7227bffef1
parent 7ec8f9a645c9ad4c00d4b86aa4be134379307ad8
Author: Lukas F. Hartmann <lukas@mntre.com>
Date: Sun, 27 Dec 2020 17:59:16 +0100
try to determine charge state based on current, not only voltage
Diffstat:
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/reform2-lpc-fw/src/boards/reform2/board_reform2.c b/reform2-lpc-fw/src/boards/reform2/board_reform2.c
@@ -36,7 +36,7 @@
#define REFORM_MBREV_R2 12
// don't forget to set this!
-#define REFORM_MOTHERBOARD_REV REFORM_MBREV_D4
+#define REFORM_MOTHERBOARD_REV REFORM_MBREV_R2
//#define REF2_DEBUG 1
#define FW_REV "R2 "
@@ -781,12 +781,14 @@ int main(void)
cycles_in_state = 0;
}
}
- else if (num_overvolted_cells < 8 && num_fully_charged_cells >= 8) {
- // 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;
- cycles_in_state = 0;
+ else if (current < 0 && current > -0.25 && num_fully_charged_cells > 4) {
+ if (cycles_in_state > 5) {
+ // 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;
+ cycles_in_state = 0;
+ }
}
else if (num_overvolted_cells > 0) {
if (cycles_in_state > 5) {