mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-04 18:29:48 +02:00
Add CAN findings
This commit is contained in:
parent
9b818bb41e
commit
06f3d123b2
2 changed files with 14 additions and 1 deletions
|
@ -13,6 +13,8 @@ static unsigned long previousMillis100 = 0; // will store last time a 100ms CAN
|
|||
static int SOC_1 = 0;
|
||||
static int SOC_2 = 0;
|
||||
static int SOC_3 = 0;
|
||||
static bool interlock_seated = true;
|
||||
static uint16_t battery_current = 0;
|
||||
|
||||
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.current_dA;
|
||||
datalayer.battery.status.current_dA = battery_current;
|
||||
|
||||
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;
|
||||
|
||||
if (!interlock_seated) {
|
||||
set_event(EVENT_HVIL_FAILURE, 0);
|
||||
} else {
|
||||
clear_event(EVENT_HVIL_FAILURE);
|
||||
}
|
||||
|
||||
#ifdef DEBUG_VIA_USB
|
||||
|
||||
#endif
|
||||
|
@ -59,8 +67,10 @@ void receive_can_battery(CAN_frame_t rx_frame) {
|
|||
case 0x588:
|
||||
break;
|
||||
case 0x5AE:
|
||||
interlock_seated = (bool)(rx_frame.data.u8[1] & 0x02) >> 1;
|
||||
break;
|
||||
case 0x5AD:
|
||||
battery_current = (rx_frame.data.u8[3] << 8) + rx_frame.data.u8[2];
|
||||
break;
|
||||
case 0x670:
|
||||
break;
|
||||
|
|
|
@ -460,6 +460,9 @@ String processor(const String& var) {
|
|||
#ifdef KIA_E_GMP_BATTERY
|
||||
content += "Kia/Hyundai EGMP platform";
|
||||
#endif
|
||||
#ifdef KIA_HYUNDAI_HYBRID_BATTERY
|
||||
content += "Kia/Hyundai Hybrid";
|
||||
#endif
|
||||
#ifdef MG_5_BATTERY
|
||||
content += "MG 5";
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue