Discharge if SDC is open and TS_Activate is sent

If we never leave TS_INACTIVE, the ABX keeps sending TS_Activate, and we
activate the TS as soon as the SDC is closed.
This commit is contained in:
Jasper Blanckenburg 2023-06-13 20:49:43 +02:00
parent 6d6c1c1f15
commit 78fe61e231
1 changed files with 14 additions and 6 deletions

View File

@ -51,12 +51,20 @@ void ts_sm_update() {
}
TSState ts_sm_update_inactive() {
if (ts_state.target_state == TS_ACTIVE && sdc_closed) {
precharge_95_reached_timestamp = 0;
return TS_PRECHARGE;
} else if (ts_state.target_state == TS_CHARGING && sdc_closed) {
charging_check_timestamp = HAL_GetTick();
return TS_CHARGING_CHECK;
if (ts_state.target_state == TS_ACTIVE) {
if (sdc_closed) {
precharge_95_reached_timestamp = 0;
return TS_PRECHARGE;
} else {
return TS_DISCHARGE;
}
} else if (ts_state.target_state == TS_CHARGING) {
if (sdc_closed) {
charging_check_timestamp = HAL_GetTick();
return TS_CHARGING_CHECK;
} else {
return TS_DISCHARGE;
}
}
return TS_INACTIVE;