Pre-commit fix

This commit is contained in:
Daniel 2024-01-17 20:51:59 +02:00
parent 3b8ec12ab8
commit 757e8d0b55

View file

@ -104,8 +104,8 @@ static uint16_t LB_GIDS = 0;
static uint16_t LB_MAX = 0; static uint16_t LB_MAX = 0;
static uint16_t LB_Max_GIDS = 273; //Startup in 24kWh mode static uint16_t LB_Max_GIDS = 273; //Startup in 24kWh mode
static uint16_t LB_StateOfHealth = 99; //State of health % static uint16_t LB_StateOfHealth = 99; //State of health %
static uint16_t LB_Total_Voltage2 = 740; //Battery voltage (0-450V) [0.5V/bit, so actual range 0-800] static uint16_t LB_Total_Voltage2 = 740; //Battery voltage (0-450V) [0.5V/bit, so actual range 0-800]
static int16_t LB_Current2 = 0; //Battery current (-400-200A) [0.5A/bit, so actual range -800-400] static int16_t LB_Current2 = 0; //Battery current (-400-200A) [0.5A/bit, so actual range -800-400]
static int16_t LB_Power = 0; //Watts going in/out of battery static int16_t LB_Power = 0; //Watts going in/out of battery
static int16_t LB_HistData_Temperature_MAX = 6; //-40 to 86*C static int16_t LB_HistData_Temperature_MAX = 6; //-40 to 86*C
static int16_t LB_HistData_Temperature_MIN = 5; //-40 to 86*C static int16_t LB_HistData_Temperature_MIN = 5; //-40 to 86*C
@ -188,7 +188,8 @@ void update_values_leaf_battery() { /* This function maps all the values fetched
remaining_capacity_Wh = LB_Wh_Remaining; remaining_capacity_Wh = LB_Wh_Remaining;
LB_Power = ((LB_Total_Voltage2 * LB_Current2) / 4); //P = U * I (Both values are 0.5 per bit so the math is non-intuitive) LB_Power =
((LB_Total_Voltage2 * LB_Current2) / 4); //P = U * I (Both values are 0.5 per bit so the math is non-intuitive)
stat_batt_power = convert2unsignedint16(LB_Power); //add sign if needed stat_batt_power = convert2unsignedint16(LB_Power); //add sign if needed
//Update temperature readings. Method depends on which generation LEAF battery is used //Update temperature readings. Method depends on which generation LEAF battery is used
@ -414,9 +415,9 @@ void receive_can_leaf_battery(CAN_frame_t rx_frame) {
if (LB_Current2 & 0x0400) { if (LB_Current2 & 0x0400) {
// negative so extend the sign bit // negative so extend the sign bit
LB_Current2 |= 0xf800; LB_Current2 |= 0xf800;
} //BatteryCurrentSignal , 2s comp, 1lSB = 0.5A/bit } //BatteryCurrentSignal , 2s comp, 1lSB = 0.5A/bit
LB_Total_Voltage2 = ((rx_frame.data.u8[2] << 2) | (rx_frame.data.u8[3] & 0xc0) >> 6); //0.5V/bit LB_Total_Voltage2 = ((rx_frame.data.u8[2] << 2) | (rx_frame.data.u8[3] & 0xc0) >> 6); //0.5V/bit
//Collect various data from the BMS //Collect various data from the BMS
LB_Relay_Cut_Request = ((rx_frame.data.u8[1] & 0x18) >> 3); LB_Relay_Cut_Request = ((rx_frame.data.u8[1] & 0x18) >> 3);