Add CAN findings

This commit is contained in:
Daniel 2024-06-11 21:39:29 +03:00
parent 9b818bb41e
commit 06f3d123b2
2 changed files with 14 additions and 1 deletions

View file

@ -13,6 +13,8 @@ static unsigned long previousMillis100 = 0; // will store last time a 100ms CAN
static int SOC_1 = 0; static int SOC_1 = 0;
static int SOC_2 = 0; static int SOC_2 = 0;
static int SOC_3 = 0; static int SOC_3 = 0;
static bool interlock_seated = true;
static uint16_t battery_current = 0;
CAN_frame_t HYBRID_200 = {.FIR = {.B = CAN_frame_t HYBRID_200 = {.FIR = {.B =
{ {
@ -28,7 +30,7 @@ void update_values_battery() { //This function maps all the values fetched via
datalayer.battery.status.voltage_dV; datalayer.battery.status.voltage_dV;
datalayer.battery.status.current_dA; datalayer.battery.status.current_dA = battery_current;
datalayer.battery.info.total_capacity_Wh; datalayer.battery.info.total_capacity_Wh;
@ -44,6 +46,12 @@ void update_values_battery() { //This function maps all the values fetched via
datalayer.battery.status.temperature_max_dC; datalayer.battery.status.temperature_max_dC;
if (!interlock_seated) {
set_event(EVENT_HVIL_FAILURE, 0);
} else {
clear_event(EVENT_HVIL_FAILURE);
}
#ifdef DEBUG_VIA_USB #ifdef DEBUG_VIA_USB
#endif #endif
@ -59,8 +67,10 @@ void receive_can_battery(CAN_frame_t rx_frame) {
case 0x588: case 0x588:
break; break;
case 0x5AE: case 0x5AE:
interlock_seated = (bool)(rx_frame.data.u8[1] & 0x02) >> 1;
break; break;
case 0x5AD: case 0x5AD:
battery_current = (rx_frame.data.u8[3] << 8) + rx_frame.data.u8[2];
break; break;
case 0x670: case 0x670:
break; break;

View file

@ -460,6 +460,9 @@ String processor(const String& var) {
#ifdef KIA_E_GMP_BATTERY #ifdef KIA_E_GMP_BATTERY
content += "Kia/Hyundai EGMP platform"; content += "Kia/Hyundai EGMP platform";
#endif #endif
#ifdef KIA_HYUNDAI_HYBRID_BATTERY
content += "Kia/Hyundai Hybrid";
#endif
#ifdef MG_5_BATTERY #ifdef MG_5_BATTERY
content += "MG 5"; content += "MG 5";
#endif #endif