From 94a17947644117a0cc735bcef1720d34ad04cbc2 Mon Sep 17 00:00:00 2001 From: Johnny Hsu Date: Thu, 18 Jul 2024 10:15:06 +0200 Subject: [PATCH] fix SOC estimation --- Core/Src/soc_estimation.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/Src/soc_estimation.c b/Core/Src/soc_estimation.c index 8143ddd..271e6e3 100644 --- a/Core/Src/soc_estimation.c +++ b/Core/Src/soc_estimation.c @@ -53,7 +53,7 @@ void soc_update() { // Otherwise, use the current counter to update SoC float as_delta = shunt_data.current_counter - mAs_before_current; float soc_delta = as_delta / SOC_ESTIMATION_BATTERY_CAPACITY * 100; - current_soc = soc_before_current + soc_delta; + current_soc = soc_before_current - soc_delta; } }