From 7a4494f5efeeeadb29794b02fd52f0d7e7036b45 Mon Sep 17 00:00:00 2001 From: hamza Date: Fri, 7 Jun 2024 00:43:00 +0300 Subject: [PATCH] addeed the correct scaling for the current sensor --- Core/Src/state_machine.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Core/Src/state_machine.c b/Core/Src/state_machine.c index aacb4d2..7008496 100644 --- a/Core/Src/state_machine.c +++ b/Core/Src/state_machine.c @@ -4,6 +4,7 @@ #include "errors.h" #include "stm32f3xx_hal.h" #include +#include StateHandle state; int16_t RELAY_BAT_SIDE_VOLTAGE; @@ -24,7 +25,7 @@ void sm_update(){ RELAY_BAT_SIDE_VOLTAGE = module.auxVoltages[0] * 12.42; // the calculation says the factor is 11.989. 12.42 yields the better result RELAY_ESC_SIDE_VOLTAGE = module.auxVoltages[1] * 12.42; - CURRENT_MEASUREMENT = module.auxVoltages[2] / 2.2; + CURRENT_MEASUREMENT = (module.auxVoltages[2] - 2496) * 300; switch (state.current_state) { case STATE_INACTIVE: