diff --git a/Software/src/battery/TESLA-BATTERY.cpp b/Software/src/battery/TESLA-BATTERY.cpp index 5ecd958e..7d372393 100644 --- a/Software/src/battery/TESLA-BATTERY.cpp +++ b/Software/src/battery/TESLA-BATTERY.cpp @@ -37,8 +37,8 @@ static uint16_t battery_energy_to_charge_complete = 0; // kWh static uint16_t battery_energy_to_charge_complete_m1 = 0; // kWh static uint16_t battery_expected_energy_remaining = 0; // kWh static uint16_t battery_expected_energy_remaining_m1 = 0; // kWh -static uint8_t battery_full_charge_complete = 0; // kWh -static uint8_t battery_fully_charged = 0; // kWh +static bool battery_full_charge_complete = false; // Changed to bool +static bool battery_fully_charged = false; // Changed to bool static uint16_t battery_ideal_energy_remaining = 0; // kWh static uint16_t battery_ideal_energy_remaining_m0 = 0; // kWh static uint16_t battery_nominal_energy_remaining = 0; // kWh @@ -98,46 +98,46 @@ static uint8_t battery_hvil_status = 0; static uint8_t battery_packContNegativeState = 0; static uint8_t battery_packContPositiveState = 0; static uint8_t battery_packContactorSetState = 0; -static uint8_t battery_packCtrsClosingAllowed = 0; -static uint8_t battery_pyroTestInProgress = 0; -static uint8_t battery_packCtrsOpenNowRequested = 0; -static uint8_t battery_packCtrsOpenRequested = 0; +static bool battery_packCtrsClosingAllowed = false; // Change to bool +static bool battery_pyroTestInProgress = false; // Change to bool +static bool battery_packCtrsOpenNowRequested = false; // Change to bool +static bool battery_packCtrsOpenRequested = false; // Change to bool static uint8_t battery_packCtrsRequestStatus = 0; -static uint8_t battery_packCtrsResetRequestRequired = 0; -static uint8_t battery_dcLinkAllowedToEnergize = 0; -static uint8_t battery_fcContNegativeAuxOpen = 0; +static bool battery_packCtrsResetRequestRequired = false; // Change to bool +static bool battery_dcLinkAllowedToEnergize = false; // Change to bool +static bool battery_fcContNegativeAuxOpen = false; // Change to bool static uint8_t battery_fcContNegativeState = 0; -static uint8_t battery_fcContPositiveAuxOpen = 0; +static bool battery_fcContPositiveAuxOpen = false; // Change to bool static uint8_t battery_fcContPositiveState = 0; static uint8_t battery_fcContactorSetState = 0; -static uint8_t battery_fcCtrsClosingAllowed = 0; -static uint8_t battery_fcCtrsOpenNowRequested = 0; -static uint8_t battery_fcCtrsOpenRequested = 0; +static bool battery_fcCtrsClosingAllowed = false; // Change to bool +static bool battery_fcCtrsOpenNowRequested = false; // Change to bool +static bool battery_fcCtrsOpenRequested = false; // Change to bool static uint8_t battery_fcCtrsRequestStatus = 0; -static uint8_t battery_fcCtrsResetRequestRequired = 0; -static uint8_t battery_fcLinkAllowedToEnergize = 0; +static bool battery_fcCtrsResetRequestRequired = false; // Change to bool +static bool battery_fcLinkAllowedToEnergize = false; // Change to bool //0x212: 530 BMS_status -static uint8_t battery_BMS_hvacPowerRequest = 0; -static uint8_t battery_BMS_notEnoughPowerForDrive = 0; -static uint8_t battery_BMS_notEnoughPowerForSupport = 0; -static uint8_t battery_BMS_preconditionAllowed = 0; -static uint8_t battery_BMS_updateAllowed = 0; -static uint8_t battery_BMS_activeHeatingWorthwhile = 0; -static uint8_t battery_BMS_cpMiaOnHvs = 0; +static bool battery_BMS_hvacPowerRequest = false; //Change to bool +static bool battery_BMS_notEnoughPowerForDrive = false; //Change to bool +static bool battery_BMS_notEnoughPowerForSupport = false; //Change to bool +static bool battery_BMS_preconditionAllowed = false; //Change to bool +static bool battery_BMS_updateAllowed = false; //Change to bool +static bool battery_BMS_activeHeatingWorthwhile = false; //Change to bool +static bool battery_BMS_cpMiaOnHvs = false; //Change to bool static uint8_t battery_BMS_contactorState = 0; static uint8_t battery_BMS_state = 0; static uint8_t battery_BMS_hvState = 0; static uint16_t battery_BMS_isolationResistance = 0; -static uint8_t battery_BMS_chargeRequest = 0; -static uint8_t battery_BMS_keepWarmRequest = 0; +static bool battery_BMS_chargeRequest = false; //Change to bool +static bool battery_BMS_keepWarmRequest = false; //Change to bool static uint8_t battery_BMS_uiChargeStatus = 0; -static uint8_t battery_BMS_diLimpRequest = 0; -static uint8_t battery_BMS_okToShipByAir = 0; -static uint8_t battery_BMS_okToShipByLand = 0; +static bool battery_BMS_diLimpRequest = false; //Change to bool +static bool battery_BMS_okToShipByAir = false; //Change to bool +static bool battery_BMS_okToShipByLand = false; //Change to bool static uint32_t battery_BMS_chgPowerAvailable = 0; static uint8_t battery_BMS_chargeRetryCount = 0; -static uint8_t battery_BMS_pcsPwmEnabled = 0; -static uint8_t battery_BMS_ecuLogUploadRequest = 0; +static bool battery_BMS_pcsPwmEnabled = false; //Change to bool +static bool battery_BMS_ecuLogUploadRequest = false; //Change to bool static uint8_t battery_BMS_minPackTemperature = 0; // 0x224:548 PCS_dcdcStatus static uint8_t battery_PCS_dcdcPrechargeStatus = 0; @@ -145,8 +145,8 @@ static uint8_t battery_PCS_dcdc12VSupportStatus = 0; static uint8_t battery_PCS_dcdcHvBusDischargeStatus = 0; static uint16_t battery_PCS_dcdcMainState = 0; static uint8_t battery_PCS_dcdcSubState = 0; -static uint8_t battery_PCS_dcdcFaulted = 0; -static uint8_t battery_PCS_dcdcOutputIsLimited = 0; +static bool battery_PCS_dcdcFaulted = false; //Change to bool +static bool battery_PCS_dcdcOutputIsLimited = false; //Change to bool static uint32_t battery_PCS_dcdcMaxOutputCurrentAllowed = 0; static uint8_t battery_PCS_dcdcPrechargeRtyCnt = 0; static uint8_t battery_PCS_dcdc12VSupportRtyCnt = 0; @@ -196,38 +196,38 @@ static uint16_t PCS_dcdcIntervalMinLvOutputCurr = 0; static uint32_t PCS_dcdc12vSupportLifetimekWh = 0; //0x7AA: //1962 HVP_debugMessage: static uint8_t HVP_debugMessageMultiplexer = 0; -static uint8_t HVP_gpioPassivePyroDepl = 0; -static uint8_t HVP_gpioPyroIsoEn = 0; -static uint8_t HVP_gpioCpFaultIn = 0; -static uint8_t HVP_gpioPackContPowerEn = 0; -static uint8_t HVP_gpioHvCablesOk = 0; -static uint8_t HVP_gpioHvpSelfEnable = 0; -static uint8_t HVP_gpioLed = 0; -static uint8_t HVP_gpioCrashSignal = 0; -static uint8_t HVP_gpioShuntDataReady = 0; -static uint8_t HVP_gpioFcContPosAux = 0; -static uint8_t HVP_gpioFcContNegAux = 0; -static uint8_t HVP_gpioBmsEout = 0; -static uint8_t HVP_gpioCpFaultOut = 0; -static uint8_t HVP_gpioPyroPor = 0; -static uint8_t HVP_gpioShuntEn = 0; -static uint8_t HVP_gpioHvpVerEn = 0; -static uint8_t HVP_gpioPackCoontPosFlywheel = 0; -static uint8_t HVP_gpioCpLatchEnable = 0; -static uint8_t HVP_gpioPcsEnable = 0; -static uint8_t HVP_gpioPcsDcdcPwmEnable = 0; -static uint8_t HVP_gpioPcsChargePwmEnable = 0; -static uint8_t HVP_gpioFcContPowerEnable = 0; -static uint8_t HVP_gpioHvilEnable = 0; -static uint8_t HVP_gpioSecDrdy = 0; +static bool HVP_gpioPassivePyroDepl = false; //Change to bool +static bool HVP_gpioPyroIsoEn = false; //Change to bool +static bool HVP_gpioCpFaultIn = false; //Change to bool +static bool HVP_gpioPackContPowerEn = false; //Change to bool +static bool HVP_gpioHvCablesOk = false; //Change to bool +static bool HVP_gpioHvpSelfEnable = false; //Change to bool +static bool HVP_gpioLed = false; //Change to bool +static bool HVP_gpioCrashSignal = false; //Change to bool +static bool HVP_gpioShuntDataReady = false; //Change to bool +static bool HVP_gpioFcContPosAux = false; //Change to bool +static bool HVP_gpioFcContNegAux = false; //Change to bool +static bool HVP_gpioBmsEout = false; //Change to bool +static bool HVP_gpioCpFaultOut = false; //Change to bool +static bool HVP_gpioPyroPor = false; //Change to bool +static bool HVP_gpioShuntEn = false; //Change to bool +static bool HVP_gpioHvpVerEn = false; //Change to bool +static bool HVP_gpioPackCoontPosFlywheel = false; //Change to bool +static bool HVP_gpioCpLatchEnable = false; //Change to bool +static bool HVP_gpioPcsEnable = false; //Change to bool +static bool HVP_gpioPcsDcdcPwmEnable = false; //Change to bool +static bool HVP_gpioPcsChargePwmEnable = false; //Change to bool +static bool HVP_gpioFcContPowerEnable = false; //Change to bool +static bool HVP_gpioHvilEnable = false; //Change to bool +static bool HVP_gpioSecDrdy = false; //Change to bool static uint16_t HVP_hvp1v5Ref = 0; static int16_t HVP_shuntCurrentDebug = 0; -static uint8_t HVP_packCurrentMia = 0; -static uint8_t HVP_auxCurrentMia = 0; -static uint8_t HVP_currentSenseMia = 0; -static uint8_t HVP_shuntRefVoltageMismatch = 0; -static uint8_t HVP_shuntThermistorMia = 0; -static uint8_t HVP_shuntHwMia = 0; +static bool HVP_packCurrentMia = false; //Change to bool +static bool HVP_auxCurrentMia = false; //Change to bool +static bool HVP_currentSenseMia =false; //Change to bool +static bool HVP_shuntRefVoltageMismatch = false; //Change to bool +static bool HVP_shuntThermistorMia = false; //Change to bool +static bool HVP_shuntHwMia = false; //Change to bool static int16_t HVP_dcLinkVoltage = 0; static int16_t HVP_packVoltage = 0; static int16_t HVP_fcLinkVoltage = 0; @@ -252,159 +252,152 @@ static int16_t HVP_shuntAsicTempDbg = 0; static uint8_t HVP_shuntAuxCurrentStatus = 0; static uint8_t HVP_shuntBarTempStatus = 0; static uint8_t HVP_shuntAsicTempStatus = 0; -//0x3aa: HVP_alertMatrix1 Fault codes -static uint8_t battery_WatchdogReset = 0; //Warns if the processor has experienced a reset due to watchdog reset. -static uint8_t battery_PowerLossReset = 0; //Warns if the processor has experienced a reset due to power loss. -static uint8_t battery_SwAssertion = 0; //An internal software assertion has failed. -static uint8_t battery_CrashEvent = 0; //Warns if the crash signal is detected by HVP -static uint8_t battery_OverDchgCurrentFault = 0; //Warns if the pack discharge is above max discharge current limit -static uint8_t battery_OverChargeCurrentFault = - 0; //Warns if the pack discharge current is above max charge current limit -static uint8_t battery_OverCurrentFault = - 0; //Warns if the pack current (discharge or charge) is above max current limit. -static uint8_t battery_OverTemperatureFault = 0; //A pack module temperature is above maximum temperature limit -static uint8_t battery_OverVoltageFault = 0; //A brick voltage is above maximum voltage limit -static uint8_t battery_UnderVoltageFault = 0; //A brick voltage is below minimum voltage limit -static uint8_t battery_PrimaryBmbMiaFault = - 0; //Warns if the voltage and temperature readings from primary BMB chain are mia -static uint8_t battery_SecondaryBmbMiaFault = - 0; //Warns if the voltage and temperature readings from secondary BMB chain are mia -static uint8_t battery_BmbMismatchFault = - 0; //Warns if the primary and secondary BMB chain readings don't match with each other -static uint8_t battery_BmsHviMiaFault = 0; //Warns if the BMS node is mia on HVS or HVI CAN -static uint8_t battery_CpMiaFault = 0; //Warns if the CP node is mia on HVS CAN -static uint8_t battery_PcsMiaFault = 0; //The PCS node is mia on HVS CAN -static uint8_t battery_BmsFault = 0; //Warns if the BMS ECU has faulted -static uint8_t battery_PcsFault = 0; //Warns if the PCS ECU has faulted -static uint8_t battery_CpFault = 0; //Warns if the CP ECU has faulted -static uint8_t battery_ShuntHwMiaFault = 0; //Warns if the shunt current reading is not available -static uint8_t battery_PyroMiaFault = 0; //Warns if the pyro squib is not connected -static uint8_t battery_hvsMiaFault = 0; //Warns if the pack contactor hw fault -static uint8_t battery_hviMiaFault = 0; //Warns if the FC contactor hw fault -static uint8_t battery_Supply12vFault = 0; //Warns if the low voltage (12V) battery is below minimum voltage threshold -static uint8_t battery_VerSupplyFault = - 0; //Warns if the Energy reserve voltage supply is below minimum voltage threshold -static uint8_t battery_HvilFault = 0; //Warn if a High Voltage Inter Lock fault is detected -static uint8_t battery_BmsHvsMiaFault = 0; //Warns if the BMS node is mia on HVS or HVI CAN -static uint8_t battery_PackVoltMismatchFault = - 0; //Warns if the pack voltage doesn't match approximately with sum of brick voltages -static uint8_t battery_EnsMiaFault = 0; //Warns if the ENS line is not connected to HVC -static uint8_t battery_PackPosCtrArcFault = 0; //Warns if the HVP detectes series arc at pack contactor -static uint8_t battery_packNegCtrArcFault = 0; //Warns if the HVP detectes series arc at FC contactor -static uint8_t battery_ShuntHwAndBmsMiaFault = 0; -static uint8_t battery_fcContHwFault = 0; -static uint8_t battery_robinOverVoltageFault = 0; -static uint8_t battery_packContHwFault = 0; -static uint8_t battery_pyroFuseBlown = 0; -static uint8_t battery_pyroFuseFailedToBlow = 0; -static uint8_t battery_CpilFault = 0; -static uint8_t battery_PackContactorFellOpen = 0; -static uint8_t battery_FcContactorFellOpen = 0; -static uint8_t battery_packCtrCloseBlocked = 0; -static uint8_t battery_fcCtrCloseBlocked = 0; -static uint8_t battery_packContactorForceOpen = 0; -static uint8_t battery_fcContactorForceOpen = 0; -static uint8_t battery_dcLinkOverVoltage = 0; -static uint8_t battery_shuntOverTemperature = 0; -static uint8_t battery_passivePyroDeploy = 0; -static uint8_t battery_logUploadRequest = 0; -static uint8_t battery_packCtrCloseFailed = 0; -static uint8_t battery_fcCtrCloseFailed = 0; -static uint8_t battery_shuntThermistorMia = 0; +//0x3aa: HVP_alertMatrix1 Fault codes // Change to bool +static bool battery_WatchdogReset = false; //Warns if the processor has experienced a reset due to watchdog reset. +static bool battery_PowerLossReset = false; //Warns if the processor has experienced a reset due to power loss. +static bool battery_SwAssertion = false; //An internal software assertion has failed. +static bool battery_CrashEvent = false; //Warns if the crash signal is detected by HVP +static bool battery_OverDchgCurrentFault = false; //Warns if the pack discharge is above max discharge current limit +static bool battery_OverChargeCurrentFault = false; //Warns if the pack discharge current is above max charge current limit +static bool battery_OverCurrentFault = false; //Warns if the pack current (discharge or charge) is above max current limit. +static bool battery_OverTemperatureFault = false; //A pack module temperature is above maximum temperature limit +static bool battery_OverVoltageFault = false; //A brick voltage is above maximum voltage limit +static bool battery_UnderVoltageFault = false; //A brick voltage is below minimum voltage limit +static bool battery_PrimaryBmbMiaFault = false; //Warns if the voltage and temperature readings from primary BMB chain are mia +static bool battery_SecondaryBmbMiaFault = false; //Warns if the voltage and temperature readings from secondary BMB chain are mia +static bool battery_BmbMismatchFault = false; //Warns if the primary and secondary BMB chain readings don't match with each other +static bool battery_BmsHviMiaFault = false; //Warns if the BMS node is mia on HVS or HVI CAN +static bool battery_CpMiaFault = false; //Warns if the CP node is mia on HVS CAN +static bool battery_PcsMiaFault = false; //The PCS node is mia on HVS CAN +static bool battery_BmsFault = false; //Warns if the BMS ECU has faulted +static bool battery_PcsFault = false; //Warns if the PCS ECU has faulted +static bool battery_CpFault = false; //Warns if the CP ECU has faulted +static bool battery_ShuntHwMiaFault = false; //Warns if the shunt current reading is not available +static bool battery_PyroMiaFault = false; //Warns if the pyro squib is not connected +static bool battery_hvsMiaFault = false; //Warns if the pack contactor hw fault +static bool battery_hviMiaFault = false; //Warns if the FC contactor hw fault +static bool battery_Supply12vFault = false; //Warns if the low voltage (12V) battery is below minimum voltage threshold +static bool battery_VerSupplyFault = false; //Warns if the Energy reserve voltage supply is below minimum voltage threshold +static bool battery_HvilFault = false; //Warn if a High Voltage Inter Lock fault is detected +static bool battery_BmsHvsMiaFault = false; //Warns if the BMS node is mia on HVS or HVI CAN +static bool battery_PackVoltMismatchFault = false; //Warns if the pack voltage doesn't match approximately with sum of brick voltages +static bool battery_EnsMiaFault = false; //Warns if the ENS line is not connected to HVC +static bool battery_PackPosCtrArcFault = false; //Warns if the HVP detectes series arc at pack contactor +static bool battery_packNegCtrArcFault = false; //Warns if the HVP detectes series arc at FC contactor +static bool battery_ShuntHwAndBmsMiaFault = false; +static bool battery_fcContHwFault = false; +static bool battery_robinOverVoltageFault = false; +static bool battery_packContHwFault = false; +static bool battery_pyroFuseBlown = false; +static bool battery_pyroFuseFailedToBlow = false; +static bool battery_CpilFault = false; +static bool battery_PackContactorFellOpen = false; +static bool battery_FcContactorFellOpen = false; +static bool battery_packCtrCloseBlocked = false; +static bool battery_fcCtrCloseBlocked = false; +static bool battery_packContactorForceOpen = false; +static bool battery_fcContactorForceOpen = false; +static bool battery_dcLinkOverVoltage = false; +static bool battery_shuntOverTemperature = false; +static bool battery_passivePyroDeploy = false; +static bool battery_logUploadRequest = false; +static bool battery_packCtrCloseFailed = false; +static bool battery_fcCtrCloseFailed = false; +static bool battery_shuntThermistorMia = false; //0x320: 800 BMS_alertMatrix -static uint8_t battery_BMS_matrixIndex = 4; -static uint8_t battery_BMS_a061_robinBrickOverVoltage = 1; -static uint8_t battery_BMS_a062_SW_BrickV_Imbalance = 1; -static uint8_t battery_BMS_a063_SW_ChargePort_Fault = 1; -static uint8_t battery_BMS_a064_SW_SOC_Imbalance = 1; -static uint8_t battery_BMS_a127_SW_shunt_SNA = 1; -static uint8_t battery_BMS_a128_SW_shunt_MIA = 1; -static uint8_t battery_BMS_a069_SW_Low_Power = 1; -static uint8_t battery_BMS_a130_IO_CAN_Error = 1; -static uint8_t battery_BMS_a071_SW_SM_TransCon_Not_Met = 1; -static uint8_t battery_BMS_a132_HW_BMB_OTP_Uncorrctbl = 1; -static uint8_t battery_BMS_a134_SW_Delayed_Ctr_Off = 1; -static uint8_t battery_BMS_a075_SW_Chg_Disable_Failure = 1; -static uint8_t battery_BMS_a076_SW_Dch_While_Charging = 1; -static uint8_t battery_BMS_a017_SW_Brick_OV = 1; -static uint8_t battery_BMS_a018_SW_Brick_UV = 1; -static uint8_t battery_BMS_a019_SW_Module_OT = 1; -static uint8_t battery_BMS_a021_SW_Dr_Limits_Regulation = 1; -static uint8_t battery_BMS_a022_SW_Over_Current = 1; -static uint8_t battery_BMS_a023_SW_Stack_OV = 1; -static uint8_t battery_BMS_a024_SW_Islanded_Brick = 1; -static uint8_t battery_BMS_a025_SW_PwrBalance_Anomaly = 1; -static uint8_t battery_BMS_a026_SW_HFCurrent_Anomaly = 1; -static uint8_t battery_BMS_a087_SW_Feim_Test_Blocked = 1; -static uint8_t battery_BMS_a088_SW_VcFront_MIA_InDrive = 1; -static uint8_t battery_BMS_a089_SW_VcFront_MIA = 1; -static uint8_t battery_BMS_a090_SW_Gateway_MIA = 1; -static uint8_t battery_BMS_a091_SW_ChargePort_MIA = 1; -static uint8_t battery_BMS_a092_SW_ChargePort_Mia_On_Hv = 1; -static uint8_t battery_BMS_a034_SW_Passive_Isolation = 1; -static uint8_t battery_BMS_a035_SW_Isolation = 1; -static uint8_t battery_BMS_a036_SW_HvpHvilFault = 1; -static uint8_t battery_BMS_a037_SW_Flood_Port_Open = 1; -static uint8_t battery_BMS_a158_SW_HVP_HVI_Comms = 1; -static uint8_t battery_BMS_a039_SW_DC_Link_Over_Voltage = 1; -static uint8_t battery_BMS_a041_SW_Power_On_Reset = 1; -static uint8_t battery_BMS_a042_SW_MPU_Error = 1; -static uint8_t battery_BMS_a043_SW_Watch_Dog_Reset = 1; -static uint8_t battery_BMS_a044_SW_Assertion = 1; -static uint8_t battery_BMS_a045_SW_Exception = 1; -static uint8_t battery_BMS_a046_SW_Task_Stack_Usage = 1; -static uint8_t battery_BMS_a047_SW_Task_Stack_Overflow = 1; -static uint8_t battery_BMS_a048_SW_Log_Upload_Request = 1; -static uint8_t battery_BMS_a169_SW_FC_Pack_Weld = 1; -static uint8_t battery_BMS_a050_SW_Brick_Voltage_MIA = 1; -static uint8_t battery_BMS_a051_SW_HVC_Vref_Bad = 1; -static uint8_t battery_BMS_a052_SW_PCS_MIA = 1; -static uint8_t battery_BMS_a053_SW_ThermalModel_Sanity = 1; -static uint8_t battery_BMS_a054_SW_Ver_Supply_Fault = 1; -static uint8_t battery_BMS_a176_SW_GracefulPowerOff = 1; -static uint8_t battery_BMS_a059_SW_Pack_Voltage_Sensing = 1; -static uint8_t battery_BMS_a060_SW_Leakage_Test_Failure = 1; -static uint8_t battery_BMS_a077_SW_Charger_Regulation = 1; -static uint8_t battery_BMS_a081_SW_Ctr_Close_Blocked = 1; -static uint8_t battery_BMS_a082_SW_Ctr_Force_Open = 1; -static uint8_t battery_BMS_a083_SW_Ctr_Close_Failure = 1; -static uint8_t battery_BMS_a084_SW_Sleep_Wake_Aborted = 1; -static uint8_t battery_BMS_a094_SW_Drive_Inverter_MIA = 1; -static uint8_t battery_BMS_a099_SW_BMB_Communication = 1; -static uint8_t battery_BMS_a105_SW_One_Module_Tsense = 1; -static uint8_t battery_BMS_a106_SW_All_Module_Tsense = 1; -static uint8_t battery_BMS_a107_SW_Stack_Voltage_MIA = 1; -static uint8_t battery_BMS_a121_SW_NVRAM_Config_Error = 1; -static uint8_t battery_BMS_a122_SW_BMS_Therm_Irrational = 1; -static uint8_t battery_BMS_a123_SW_Internal_Isolation = 1; -static uint8_t battery_BMS_a129_SW_VSH_Failure = 1; -static uint8_t battery_BMS_a131_Bleed_FET_Failure = 1; -static uint8_t battery_BMS_a136_SW_Module_OT_Warning = 1; -static uint8_t battery_BMS_a137_SW_Brick_UV_Warning = 1; -static uint8_t battery_BMS_a138_SW_Brick_OV_Warning = 1; -static uint8_t battery_BMS_a139_SW_DC_Link_V_Irrational = 1; -static uint8_t battery_BMS_a141_SW_BMB_Status_Warning = 1; -static uint8_t battery_BMS_a144_Hvp_Config_Mismatch = 1; -static uint8_t battery_BMS_a145_SW_SOC_Change = 1; -static uint8_t battery_BMS_a146_SW_Brick_Overdischarged = 1; -static uint8_t battery_BMS_a149_SW_Missing_Config_Block = 1; -static uint8_t battery_BMS_a151_SW_external_isolation = 1; -static uint8_t battery_BMS_a156_SW_BMB_Vref_bad = 1; -static uint8_t battery_BMS_a157_SW_HVP_HVS_Comms = 1; -static uint8_t battery_BMS_a159_SW_HVP_ECU_Error = 1; -static uint8_t battery_BMS_a161_SW_DI_Open_Request = 1; -static uint8_t battery_BMS_a162_SW_No_Power_For_Support = 1; -static uint8_t battery_BMS_a163_SW_Contactor_Mismatch = 1; -static uint8_t battery_BMS_a164_SW_Uncontrolled_Regen = 1; -static uint8_t battery_BMS_a165_SW_Pack_Partial_Weld = 1; -static uint8_t battery_BMS_a166_SW_Pack_Full_Weld = 1; -static uint8_t battery_BMS_a167_SW_FC_Partial_Weld = 1; -static uint8_t battery_BMS_a168_SW_FC_Full_Weld = 1; -static uint8_t battery_BMS_a170_SW_Limp_Mode = 1; -static uint8_t battery_BMS_a171_SW_Stack_Voltage_Sense = 1; -static uint8_t battery_BMS_a174_SW_Charge_Failure = 1; -static uint8_t battery_BMS_a179_SW_Hvp_12V_Fault = 1; -static uint8_t battery_BMS_a180_SW_ECU_reset_blocked = 1; +static uint8_t battery_BMS_matrixIndex = 0; // Changed to bool +static bool battery_BMS_a061_robinBrickOverVoltage = false; +static bool battery_BMS_a062_SW_BrickV_Imbalance = false; +static bool battery_BMS_a063_SW_ChargePort_Fault = false; +static bool battery_BMS_a064_SW_SOC_Imbalance = false; +static bool battery_BMS_a027_SW_shunt_SNA = false; +static bool battery_BMS_a128_SW_shunt_MIA = false; +static bool battery_BMS_a069_SW_Low_Power = false; +static bool battery_BMS_a130_IO_CAN_Error = false; +static bool battery_BMS_a071_SW_SM_TransCon_Not_Met = false; +static bool battery_BMS_a132_HW_BMB_OTP_Uncorrctbl = false; +static bool battery_BMS_a134_SW_Delayed_Ctr_Off = false; +static bool battery_BMS_a075_SW_Chg_Disable_Failure = false; +static bool battery_BMS_a076_SW_Dch_While_Charging = false; +static bool battery_BMS_a017_SW_Brick_OV = false; +static bool battery_BMS_a018_SW_Brick_UV = false; +static bool battery_BMS_a019_SW_Module_OT = false; +static bool battery_BMS_a021_SW_Dr_Limits_Regulation = false; +static bool battery_BMS_a022_SW_Over_Current = false; +static bool battery_BMS_a023_SW_Stack_OV = false; +static bool battery_BMS_a024_SW_Islanded_Brick = false; +static bool battery_BMS_a025_SW_PwrBalance_Anomaly = false; +static bool battery_BMS_a026_SW_HFCurrent_Anomaly = false; +static bool battery_BMS_a087_SW_Feim_Test_Blocked = false; +static bool battery_BMS_a088_SW_VcFront_MIA_InDrive = false; +static bool battery_BMS_a089_SW_VcFront_MIA = false; +static bool battery_BMS_a090_SW_Gateway_MIA = false; +static bool battery_BMS_a091_SW_ChargePort_MIA = false; +static bool battery_BMS_a092_SW_ChargePort_Mia_On_Hv = false; +static bool battery_BMS_a034_SW_Passive_Isolation = false; +static bool battery_BMS_a035_SW_Isolation = false; +static bool battery_BMS_a036_SW_HvpHvilFault = false; +static bool battery_BMS_a037_SW_Flood_Port_Open = false; +static bool battery_BMS_a158_SW_HVP_HVI_Comms = false; +static bool battery_BMS_a039_SW_DC_Link_Over_Voltage = false; +static bool battery_BMS_a041_SW_Power_On_Reset = false; +static bool battery_BMS_a042_SW_MPU_Error = false; +static bool battery_BMS_a043_SW_Watch_Dog_Reset = false; +static bool battery_BMS_a044_SW_Assertion = false; +static bool battery_BMS_a045_SW_Exception = false; +static bool battery_BMS_a046_SW_Task_Stack_Usage = false; +static bool battery_BMS_a047_SW_Task_Stack_Overflow = false; +static bool battery_BMS_a048_SW_Log_Upload_Request = false; +static bool battery_BMS_a169_SW_FC_Pack_Weld = false; +static bool battery_BMS_a050_SW_Brick_Voltage_MIA = false; +static bool battery_BMS_a051_SW_HVC_Vref_Bad = false; +static bool battery_BMS_a052_SW_PCS_MIA = false; +static bool battery_BMS_a053_SW_ThermalModel_Sanity = false; +static bool battery_BMS_a054_SW_Ver_Supply_Fault = false; +static bool battery_BMS_a176_SW_GracefulPowerOff = false; +static bool battery_BMS_a059_SW_Pack_Voltage_Sensing = false; +static bool battery_BMS_a060_SW_Leakage_Test_Failure = false; +static bool battery_BMS_a077_SW_Charger_Regulation = false; +static bool battery_BMS_a081_SW_Ctr_Close_Blocked = false; +static bool battery_BMS_a082_SW_Ctr_Force_Open = false; +static bool battery_BMS_a083_SW_Ctr_Close_Failure = false; +static bool battery_BMS_a084_SW_Sleep_Wake_Aborted = false; +static bool battery_BMS_a094_SW_Drive_Inverter_MIA = false; +static bool battery_BMS_a099_SW_BMB_Communication = false; +static bool battery_BMS_a105_SW_One_Module_Tsense = false; +static bool battery_BMS_a106_SW_All_Module_Tsense = false; +static bool battery_BMS_a107_SW_Stack_Voltage_MIA = false; +static bool battery_BMS_a121_SW_NVRAM_Config_Error = false; +static bool battery_BMS_a122_SW_BMS_Therm_Irrational = false; +static bool battery_BMS_a123_SW_Internal_Isolation = false; +static bool battery_BMS_a129_SW_VSH_Failure = false; +static bool battery_BMS_a131_Bleed_FET_Failure = false; +static bool battery_BMS_a136_SW_Module_OT_Warning = false; +static bool battery_BMS_a137_SW_Brick_UV_Warning = false; +static bool battery_BMS_a138_SW_Brick_OV_Warning = false; +static bool battery_BMS_a139_SW_DC_Link_V_Irrational = false; +static bool battery_BMS_a141_SW_BMB_Status_Warning = false; +static bool battery_BMS_a144_Hvp_Config_Mismatch = false; +static bool battery_BMS_a145_SW_SOC_Change = false; +static bool battery_BMS_a146_SW_Brick_Overdischarged = false; +static bool battery_BMS_a149_SW_Missing_Config_Block = false; +static bool battery_BMS_a151_SW_external_isolation = false; +static bool battery_BMS_a156_SW_BMB_Vref_bad = false; +static bool battery_BMS_a157_SW_HVP_HVS_Comms = false; +static bool battery_BMS_a159_SW_HVP_ECU_Error = false; +static bool battery_BMS_a161_SW_DI_Open_Request = false; +static bool battery_BMS_a162_SW_No_Power_For_Support = false; +static bool battery_BMS_a163_SW_Contactor_Mismatch = false; +static bool battery_BMS_a164_SW_Uncontrolled_Regen = false; +static bool battery_BMS_a165_SW_Pack_Partial_Weld = false; +static bool battery_BMS_a166_SW_Pack_Full_Weld = false; +static bool battery_BMS_a167_SW_FC_Partial_Weld = false; +static bool battery_BMS_a168_SW_FC_Full_Weld = false; +static bool battery_BMS_a170_SW_Limp_Mode = false; +static bool battery_BMS_a171_SW_Stack_Voltage_Sense = false; +static bool battery_BMS_a174_SW_Charge_Failure = false; +static bool battery_BMS_a179_SW_Hvp_12V_Fault = false; +static bool battery_BMS_a180_SW_ECU_reset_blocked = false; #ifdef DOUBLE_BATTERY //need to update for battery2