Pre-commit fix

This commit is contained in:
Daniel 2024-01-06 23:57:36 +02:00
parent 958ddde672
commit 4a65fb9b16
4 changed files with 33 additions and 36 deletions

View file

@ -6,7 +6,6 @@
#define LB_MAX_SOC 1000 //BMS never goes over this value. We use this info to rescale SOC% sent to Fronius
#define LB_MIN_SOC 0 //BMS never goes below this value. We use this info to rescale SOC% sent to Fronius
static uint32_t LB_Battery_Voltage = 3700;
static uint32_t LB_Charge_Power_Limit_Watts = 0;
static uint32_t LB_Discharge_Power_Limit_Watts = 0;
@ -22,33 +21,32 @@ static uint16_t LB_kWh_Remaining = 0;
static uint16_t LB_Cell_Max_Voltage = 3700;
static uint16_t LB_Cell_Min_Voltage = 3700;
static uint16_t cell_deviation_mV = 0; //contains the deviation between highest and lowest cell in mV
static uint8_t CANstillAlive = 12; //counter for checking if CAN is still alive
static uint8_t CANstillAlive = 12; //counter for checking if CAN is still alive
static uint8_t LB_Discharge_Power_Limit_Byte1 = 0;
static uint8_t GVI_Pollcounter = 0;
static bool GVB_79B_Continue = false;
CAN_frame_t KANGOO_423 = {.FIR = {.B =
{
.DLC = 8,
.FF = CAN_frame_std,
}},
.MsgID = 0x423,
.data = {0x33, 0x00, 0xFF, 0xFF, 0x00, 0xE0, 0x00, 0x00}};
{
.DLC = 8,
.FF = CAN_frame_std,
}},
.MsgID = 0x423,
.data = {0x33, 0x00, 0xFF, 0xFF, 0x00, 0xE0, 0x00, 0x00}};
CAN_frame_t KANGOO_79B = {.FIR = {.B =
{
.DLC = 8,
.FF = CAN_frame_std,
}},
.MsgID = 0x79B,
.data = {0x02, 0x21, 0x01, 0x00, 0x00, 0xE0, 0x00, 0x00}};
{
.DLC = 8,
.FF = CAN_frame_std,
}},
.MsgID = 0x79B,
.data = {0x02, 0x21, 0x01, 0x00, 0x00, 0xE0, 0x00, 0x00}};
CAN_frame_t KANGOO_79B_Continue = {.FIR = {.B =
{
.DLC = 8,
.FF = CAN_frame_std,
}},
.MsgID = 0x79B,
.data = {0x030, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}};
{
.DLC = 8,
.FF = CAN_frame_std,
}},
.MsgID = 0x79B,
.data = {0x030, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}};
static unsigned long previousMillis10 = 0; // will store last time a 10ms CAN Message was sent
static unsigned long previousMillis100 = 0; // will store last time a 100ms CAN Message was sent
@ -59,7 +57,7 @@ static const int interval100 = 100; // interval (ms) at which send CAN Messag
static const int interval1000 = 1000; // interval (ms) at which send CAN Messages
void update_values_kangoo_battery() { //This function maps all the values fetched via CAN to the correct parameters used for modbus
bms_status = ACTIVE; //Startout in active mode
bms_status = ACTIVE; //Startout in active mode
StateOfHealth = (LB_SOH * 100); //Increase range from 99% -> 99.00%
@ -179,7 +177,7 @@ void update_values_kangoo_battery() { //This function maps all the values fetch
#endif
}
void receive_can_kangoo_battery(CAN_frame_t rx_frame) //GKOE reworked
void receive_can_kangoo_battery(CAN_frame_t rx_frame) //GKOE reworked
{
switch (rx_frame.MsgID) {

View file

@ -31,8 +31,8 @@ extern uint16_t temperature_max; //C+1, Goes thru convert2unsignedint16 funct
extern uint16_t cell_max_voltage; //mV, 0-4350
extern uint16_t cell_min_voltage; //mV, 0-4350
extern uint16_t CANerror;
extern uint8_t LEDcolor; //Enum, 0-10
extern bool batteryAllowsContactorClosing; //Bool, 1=true, 0=false
extern uint8_t LEDcolor; //Enum, 0-10
extern bool batteryAllowsContactorClosing; //Bool, 1=true, 0=false
extern bool inverterAllowsContactorClosing; //Bool, 1=true, 0=false
// Definitions for BMS status

View file

@ -138,15 +138,14 @@ void update_values_zoe_battery() { //This function maps all the values fetched
#endif
}
void receive_can_zoe_battery(CAN_frame_t rx_frame)
{
void receive_can_zoe_battery(CAN_frame_t rx_frame) {
switch (rx_frame.MsgID) {
case 0x42E: //HV SOC & Battery Temp & Charging Power
case 0x42E: //HV SOC & Battery Temp & Charging Power
break;
case 0x430: //HVBatteryCoolingState & HVBatteryEvapTemp & HVBatteryEvapSetpoint
case 0x430: //HVBatteryCoolingState & HVBatteryEvapTemp & HVBatteryEvapSetpoint
break;
case 0x432: //BatVEShutDownAlert & HVBatCondPriorityLevel & HVBatteryLevelAlert & HVBatCondPriorityLevel & HVBatteryConditioningMode
case 0x432: //BatVEShutDownAlert & HVBatCondPriorityLevel & HVBatteryLevelAlert & HVBatCondPriorityLevel & HVBatteryConditioningMode
break;
default:
break;
@ -156,13 +155,13 @@ void receive_can_zoe_battery(CAN_frame_t rx_frame)
void send_can_zoe_battery() {
unsigned long currentMillis = millis();
// Send 100ms CAN Message
if (currentMillis - previousMillis100 >= interval100){
if (currentMillis - previousMillis100 >= interval100) {
previousMillis100 = currentMillis;
//ESP32Can.CANWriteFrame(&ZOE_423);
}
// 1000ms CAN handling
if (currentMillis - previousMillis1000 >= interval1000){
if (currentMillis - previousMillis1000 >= interval1000) {
previousMillis1000 = currentMillis;
//ESP32Can.CANWriteFrame(&ZOE_423);
//ESP32Can.CANWriteFrame(&ZOE_423);
}
}
}

View file

@ -31,8 +31,8 @@ extern uint16_t temperature_max; //C+1, Goes thru convert2unsignedint16 funct
extern uint16_t cell_max_voltage; //mV, 0-4350
extern uint16_t cell_min_voltage; //mV, 0-4350
extern uint16_t CANerror;
extern uint8_t LEDcolor; //Enum, 0-10
extern bool batteryAllowsContactorClosing; //Bool, 1=true, 0=false
extern uint8_t LEDcolor; //Enum, 0-10
extern bool batteryAllowsContactorClosing; //Bool, 1=true, 0=false
extern bool inverterAllowsContactorClosing; //Bool, 1=true, 0=false
// Definitions for BMS status