Alter BMS_a145_SW_SOC_Change event to once only

This commit is contained in:
James Brookes 2025-09-25 19:09:46 +01:00
parent 95ee6ff9ae
commit c6b7ff82c0
2 changed files with 5 additions and 2 deletions

View file

@ -484,10 +484,12 @@ void TeslaBattery::
clear_event(EVENT_BATTERY_FUSE);
}
// Raise any informational Tesla BMS events in BE
if (BMS_a145_SW_SOC_Change == true) { // BMS has recalibrated pack SOC
if (BMS_a145_SW_SOC_Change == true && !BMS_SW_SOC_Change_Latch) { // BMS has newly recalibrated pack SOC
BMS_SW_SOC_Change_Latch = true; // Only set event once, BMS_a145 can be active for a while
set_event(EVENT_BATTERY_SOC_RECALIBRATION, 0);
} else {
clear_event(EVENT_BATTERY_SOC_RECALIBRATION);
} else if (BMS_a145_SW_SOC_Change == false) {
BMS_SW_SOC_Change_Latch = false;
}
if (user_selected_tesla_GTW_chassisType > 1) { //{{0, "Model S"}, {1, "Model X"}, {2, "Model 3"}, {3, "Model Y"}};

View file

@ -877,6 +877,7 @@ class TeslaBattery : public CanBattery {
bool BMS_a141_SW_BMB_Status_Warning = false;
bool BMS_a144_Hvp_Config_Mismatch = false;
bool BMS_a145_SW_SOC_Change = false;
bool BMS_SW_SOC_Change_Latch = false;
bool BMS_a146_SW_Brick_Overdischarged = false;
bool BMS_a149_SW_Missing_Config_Block = false;
bool BMS_a151_SW_external_isolation = false;