diff --git a/modules/EvseManager/Charger.cpp b/modules/EvseManager/Charger.cpp index ef4dc2191..34d1ad93a 100644 --- a/modules/EvseManager/Charger.cpp +++ b/modules/EvseManager/Charger.cpp @@ -793,6 +793,20 @@ void Charger::process_cp_events_state(CPEvent cp_event) { if (cp_event == CPEvent::CarRequestedStopPower) { shared_context.iec_allow_close_contactor = false; shared_context.current_state = EvseState::ChargingPausedEV; + // Tell HLC stack to stop the session. Normally the session should have already been stopped by the EV, but + // if this is not the case, we have to do it here. + if (shared_context.hlc_charging_active) { + signal_hlc_stop_charging(); + session_log.evse(false, "CP state transition C->B at this stage violates ISO15118-2"); + } + } else if (cp_event == CPEvent::BCDtoEF) { + shared_context.iec_allow_close_contactor = false; + shared_context.current_state = EvseState::StoppingCharging; + // Tell HLC stack to stop the session in case of an E/F event while charging. + if (shared_context.hlc_charging_active) { + signal_hlc_stop_charging(); + session_log.evse(false, "CP state transition C->E/F at this stage violates ISO15118-2"); + } } break; diff --git a/modules/EvseManager/IECStateMachine.cpp b/modules/EvseManager/IECStateMachine.cpp index 47a82118e..317e5932e 100644 --- a/modules/EvseManager/IECStateMachine.cpp +++ b/modules/EvseManager/IECStateMachine.cpp @@ -280,6 +280,12 @@ std::queue IECStateMachine::state_machine() { if (last_cp_state != RawCPState::E) { timer = TimerControl::stop; call_allow_power_on_bsp(false); + pwm_running = false; + r_bsp->call_pwm_off(); + if (last_cp_state == RawCPState::B || last_cp_state == RawCPState::C || + last_cp_state == RawCPState::D) { + events.push(CPEvent::BCDtoEF); + } } break; @@ -287,6 +293,11 @@ std::queue IECStateMachine::state_machine() { connector_unlock(); timer = TimerControl::stop; call_allow_power_on_bsp(false); + pwm_running = false; + r_bsp->call_pwm_off(); + if (last_cp_state == RawCPState::B || last_cp_state == RawCPState::C || last_cp_state == RawCPState::D) { + events.push(CPEvent::BCDtoEF); + } break; }