Rewrite error handling to stop sending CAN

This commit is contained in:
Daniel 2023-07-26 14:52:42 +03:00
parent e2cec23017
commit af7157e403

View file

@ -87,16 +87,6 @@ void update_values_can_byd()
//Temperature min //Temperature min
BYD_210.data.u8[2] = (temperature_min >> 8); BYD_210.data.u8[2] = (temperature_min >> 8);
BYD_210.data.u8[3] = (temperature_min & 0x00FF); BYD_210.data.u8[3] = (temperature_min & 0x00FF);
//Indicate to inverter if BMS has encountered issues
if(bms_status == FAULT)
{
BYD_190.data.u8[2] = 0x00; //We are not sure what this means, but battery control will be stopped for 5minutes if this is sent
} //Todo, maybe try other values and see if the inverter stops permanently until next reboot?
else
{
BYD_190.data.u8[2] = 0x03; //Indicates battery is OK to continue
}
} }
void receive_can_byd(CAN_frame_t rx_frame) void receive_can_byd(CAN_frame_t rx_frame)
@ -123,6 +113,9 @@ void send_can_byd()
send_intial_data(); send_intial_data();
initialDataSent = 1; initialDataSent = 1;
} }
if(bms_status != FAULT)
{ // Send CAN messages towards inverter if battery is OK
// Send 2s CAN Message // Send 2s CAN Message
if (currentMillis - previousMillis2s >= interval2s) if (currentMillis - previousMillis2s >= interval2s)
{ {
@ -148,6 +141,7 @@ void send_can_byd()
ESP32Can.CANWriteFrame(&BYD_190); ESP32Can.CANWriteFrame(&BYD_190);
//Serial.println("CAN 60s done"); //Serial.println("CAN 60s done");
} }
}
} }
void send_intial_data() void send_intial_data()