2 Commits

Author SHA1 Message Date
de184afd03 add -Wextra compiler flag
(but turn off warnings for unused parameters)
2023-12-04 18:43:17 +01:00
cef05f52bc Multiply SoC delta by 100 to get percentage 2023-08-01 14:39:01 +02:00
4 changed files with 1167 additions and 9 deletions

View File

@ -21,7 +21,6 @@ float current_soc;
int current_was_flowing;
uint32_t last_current_time;
uint32_t first_current_time;
float soc_before_current;
float mAs_before_current;
@ -36,7 +35,6 @@ void soc_update() {
if (shunt_data.current >= SOC_ESTIMATION_NO_CURRENT_THRESH) {
last_current_time = now;
if (!current_was_flowing) {
first_current_time = now;
soc_before_current = current_soc;
mAs_before_current = shunt_data.current_counter;
}
@ -53,8 +51,8 @@ void soc_update() {
} else {
// Otherwise, use the current counter to update SoC
float as_delta = shunt_data.current_counter - mAs_before_current;
current_soc =
soc_before_current + as_delta / SOC_ESTIMATION_BATTERY_CAPACITY;
float soc_delta = as_delta / SOC_ESTIMATION_BATTERY_CAPACITY * 100;
current_soc = soc_before_current + soc_delta;
}
}

View File

@ -40,7 +40,7 @@ cxxDefinitionsFile:
asDefinitionsFile:
# Compiler flags
cFlags: []
cFlags: [-Wall, -Wextra, -Wno-unused-parameter]
cxxFlags: []
assemblyFlags: []
linkerFlags:

View File

@ -43,6 +43,7 @@ Core/Src/main.c \
Core/Src/shunt_monitoring.c \
Core/Src/slave_monitoring.c \
Core/Src/soc_estimation.c \
Core/Src/status_led.c \
Core/Src/stm32f3xx_hal_msp.c \
Core/Src/stm32f3xx_it.c \
Core/Src/system_stm32f3xx.c \
@ -86,7 +87,7 @@ PREFIX = arm-none-eabi-
POSTFIX = "
# The gcc compiler bin path can be either defined in make command via GCC_PATH variable (> make GCC_PATH=xxx)
# either it can be added to the PATH environment variable.
GCC_PATH="/home/jasper/.config/Code/User/globalStorage/bmd.stm32-for-vscode/@xpack-dev-tools/arm-none-eabi-gcc/11.3.1-1.1.2/.content/bin
GCC_PATH="/home/kbracher/.vscode-server/data/User/globalStorage/bmd.stm32-for-vscode/@xpack-dev-tools/arm-none-eabi-gcc/12.3.1-1.2.1/.content/bin
ifdef GCC_PATH
CXX = $(GCC_PATH)/$(PREFIX)g++$(POSTFIX)
CC = $(GCC_PATH)/$(PREFIX)gcc$(POSTFIX)
@ -162,7 +163,7 @@ CXXFLAGS += -g -gdwarf -ggdb
endif
# Add additional flags
CFLAGS +=
CFLAGS += -Wall -Wextra -Wno-unused-parameter
ASFLAGS +=
CXXFLAGS +=
@ -242,13 +243,13 @@ $(BUILD_DIR):
# flash
#######################################
flash: $(BUILD_DIR)/$(TARGET).elf
"/home/jasper/.config/Code/User/globalStorage/bmd.stm32-for-vscode/@xpack-dev-tools/openocd/0.11.0-5.1/.content/bin/openocd" -f ./openocd.cfg -c "program $(BUILD_DIR)/$(TARGET).elf verify reset exit"
"/home/kbracher/.vscode-server/data/User/globalStorage/bmd.stm32-for-vscode/@xpack-dev-tools/openocd/0.12.0-2.1/.content/bin/openocd" -f ./openocd.cfg -c "program $(BUILD_DIR)/$(TARGET).elf verify reset exit"
#######################################
# erase
#######################################
erase: $(BUILD_DIR)/$(TARGET).elf
"/home/jasper/.config/Code/User/globalStorage/bmd.stm32-for-vscode/@xpack-dev-tools/openocd/0.11.0-5.1/.content/bin/openocd" -f ./openocd.cfg -c "init; reset halt; stm32f3x mass_erase 0; exit"
"/home/kbracher/.vscode-server/data/User/globalStorage/bmd.stm32-for-vscode/@xpack-dev-tools/openocd/0.12.0-2.1/.content/bin/openocd" -f ./openocd.cfg -c "init; reset halt; stm32f3x mass_erase 0; exit"
#######################################
# clean up

1159
compile_commands.json Normal file

File diff suppressed because it is too large Load Diff