From 0aad11d9bc7c47a96fd0eca977856e419542dd91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20=C3=96ster?= Date: Thu, 11 Sep 2025 23:27:15 +0300 Subject: [PATCH] Add contactor state to more battery info --- Software/src/battery/ECMP-BATTERY.cpp | 3 ++- Software/src/battery/ECMP-HTML.h | 11 ++++++++++- Software/src/datalayer/datalayer_extended.h | 1 + 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Software/src/battery/ECMP-BATTERY.cpp b/Software/src/battery/ECMP-BATTERY.cpp index eb47aff9..ebcd0c27 100644 --- a/Software/src/battery/ECMP-BATTERY.cpp +++ b/Software/src/battery/ECMP-BATTERY.cpp @@ -193,6 +193,7 @@ void EcmpBattery::update_values() { datalayer_extended.stellantisECMP.pid_SOH_cell_1 = pid_SOH_cell_1; // Update extended datalayer for MysteryVan datalayer_extended.stellantisECMP.MysteryVan = MysteryVan; + datalayer_extended.stellantisECMP.CONTACTORS_STATE = CONTACTORS_STATE; datalayer_extended.stellantisECMP.CrashMemorized = HV_BATT_CRASH_MEMORIZED; datalayer_extended.stellantisECMP.CONTACTOR_OPENING_REASON = CONTACTOR_OPENING_REASON; datalayer_extended.stellantisECMP.TBMU_FAULT_TYPE = TBMU_FAULT_TYPE; @@ -268,7 +269,7 @@ void EcmpBattery::handle_incoming_can_frame(CAN_frame rx_frame) { //TBMU_EVSE_DC_MES_CURRENT = (rx_frame.data.u8[3] << 4) | ((rx_frame.data.u8[4] & 0xF0) >> 4); //A -2000 - 2000 //Fastcharger info, not needed for BE //TBMU_EVSE_CHRG_REQ = (rx_frame.data.u8[4] & 0x0C) >> 2; //00 No request, 01 Stop request //Fastcharger info, not needed for BE //HV_STORAGE_MAX_I = ((rx_frame.data.u8[4] & 0x03) << 12) | (rx_frame.data.u8[5] << 2) | //Fastcharger info, not needed for BE - ((rx_frame.data.u8[6] & 0xC0) >> 6); //A -2000 - 2000 + //((rx_frame.data.u8[6] & 0xC0) >> 6); //A -2000 - 2000 //TBMU_EVSE_DC_MAX_POWER = ((rx_frame.data.u8[6] & 0x3F) << 8) | rx_frame.data.u8[7]; //W -1000000 - 0 //Fastcharger info, not needed for BE break; case 0x3F4: //MysteryVan 50/75kWh platform (Temperature sensors) diff --git a/Software/src/battery/ECMP-HTML.h b/Software/src/battery/ECMP-HTML.h index 4b8da671..0b177feb 100644 --- a/Software/src/battery/ECMP-HTML.h +++ b/Software/src/battery/ECMP-HTML.h @@ -384,7 +384,16 @@ class EcmpHtmlRenderer : public BatteryHtmlRenderer { ""; if (datalayer_extended.stellantisECMP.MysteryVan) { - content += "

MysteryVan platform detected!

"; + content += "

MysteryVan platform detected!

"; + content += "

Contactor State: "; + if (datalayer_extended.stellantisECMP.CONTACTORS_STATE == 0) { + content += "Open"; + } else if (datalayer_extended.stellantisECMP.CONTACTORS_STATE == 1) { + content += "Precharge"; + } else if (datalayer_extended.stellantisECMP.CONTACTORS_STATE == 2) { + content += "Closed"; + } + content += "

"; content += "

Crash Memorized: "; if (datalayer_extended.stellantisECMP.CrashMemorized) { content += "Yes

"; diff --git a/Software/src/datalayer/datalayer_extended.h b/Software/src/datalayer/datalayer_extended.h index ebd6fbc3..07406f6f 100644 --- a/Software/src/datalayer/datalayer_extended.h +++ b/Software/src/datalayer/datalayer_extended.h @@ -240,6 +240,7 @@ struct DATALAYER_INFO_ECMP { bool CrashMemorized = false; uint8_t CONTACTOR_OPENING_REASON = 0; uint8_t TBMU_FAULT_TYPE = 0; + uint8_t CONTACTORS_STATE = 0; uint16_t HV_BATT_FC_INSU_MINUS_RES, HV_BATT_FC_INSU_PLUS_RES, HV_BATT_FC_VHL_INSU_PLUS_RES, HV_BATT_ONLY_INSU_MINUS_RES = 0; bool ALERT_CELL_POOR_CONSIST, ALERT_OVERCHARGE, ALERT_BATT, ALERT_LOW_SOC, ALERT_HIGH_SOC, ALERT_SOC_JUMP,