Skip to content

Commit

Permalink
Map cellvoltages to variable used for inverter
Browse files Browse the repository at this point in the history
  • Loading branch information
dalathegreat committed Sep 17, 2023
1 parent cb0522f commit 75595b3
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Software/NISSAN-LEAF-BATTERY.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,9 @@ void receive_can_leaf_battery(CAN_frame_t rx_frame)

cell_deviation_mV = (min_max_voltage[1] - min_max_voltage[0]);

cell_max_voltage = min_max_voltage[1];
cell_min_voltage = min_max_voltage[0];

if(cell_deviation_mV > MAX_CELL_DEVIATION){
LEDcolor = YELLOW;
Serial.println("HIGH CELL DEVIATION!!! Inspect battery!");
Expand Down
2 changes: 2 additions & 0 deletions Software/NISSAN-LEAF-BATTERY.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ extern uint16_t bms_char_dis_status;
extern uint16_t stat_batt_power;
extern uint16_t temperature_min;
extern uint16_t temperature_max;
extern uint16_t cell_max_voltage;
extern uint16_t cell_min_voltage;
extern uint8_t batteryAllowsContactorClosing;
extern uint8_t LEDcolor;
// Definitions for BMS status
Expand Down
4 changes: 4 additions & 0 deletions Software/TESLA-MODEL-3-BATTERY.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ void update_values_tesla_model_3_battery()
max_temp = (max_temp * 10);
temperature_max = convert2unsignedint16(max_temp);

cell_max_voltage = cell_max_v;

cell_min_voltage = cell_min_v;

/* Value mapping is completed. Start to check all safeties */

bms_status = ACTIVE; //Startout in active mode before checking if we have any faults
Expand Down
2 changes: 2 additions & 0 deletions Software/TESLA-MODEL-3-BATTERY.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ extern uint16_t stat_batt_power;
extern uint16_t temperature_min;
extern uint16_t temperature_max;
extern uint16_t CANerror;
extern uint16_t cell_max_voltage;
extern uint16_t cell_min_voltage;
extern uint8_t LEDcolor;
// Definitions for BMS status
#define STANDBY 0
Expand Down

0 comments on commit 75595b3

Please sign in to comment.