Skip to content

Commit

Permalink
i forgot to test the build
Browse files Browse the repository at this point in the history
  • Loading branch information
Sabramz committed Feb 9, 2024
1 parent 2c4bb50 commit 3bfce42
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Core/Inc/analyzer.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//#include <nerduino.h> Replace
#include "datastructs.h"
#include "segment.h"
#include "stm32fxx_hal.h"
#include "stm32f4xx_hal.h"

/* We want to make sure we aren't doing useless analysis on the same set of data since we are
* backfilling segment data */
Expand Down
9 changes: 4 additions & 5 deletions Core/Src/analyzer.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ bool is_first_reading_ = true;
void disable_therms();
void high_curr_therm_check();
void diff_curr_therm_check();
bms_fault_t calc_state_of_charge();
void calc_state_of_charge();

void calc_cell_temps()
{
Expand Down Expand Up @@ -500,13 +500,12 @@ void disable_therms()
}

uint32_t last_tick = 0;
uint16_t last_voltage;

void calc_state_of_charge()
{

if (bmsdata->pack_current) {

int32_t delta_time = HAL_GetTick() - last_tick;
int32_t new_voltage = bmsdata->pack_voltage + delta_time * (bmsdata->pack_current * 100);

Expand All @@ -521,9 +520,9 @@ void calc_state_of_charge()
= ((uint16_t)(MAX_VOLT * 10000 - MIN_VOLT * 10000) / ((MAX_VOLT - MIN_VOLT) * 10));

/* Retrieving a index of 0-18 */
bmsdata->soc = ((bmsdata->min_ocv.val) - MIN_VOLT * 10000) / increments;
uint8_t index = ((bmsdata->min_ocv.val) - MIN_VOLT * 10000) / increments;

interpolated_soc = STATE_OF_CHARGE_CURVE[index];
bmsdata->soc = STATE_OF_CHARGE_CURVE[index];

if (bmsdata->soc != 100) {
float interpolation
Expand Down

0 comments on commit 3bfce42

Please sign in to comment.