Skip to content

Commit

Permalink
Only allow force_unlock commands in states B and C
Browse files Browse the repository at this point in the history
Signed-off-by: Cornelius Claussen <cc@pionix.de>
  • Loading branch information
corneliusclaussen committed Feb 13, 2024
1 parent b88919d commit e0ebd57
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
12 changes: 11 additions & 1 deletion modules/EvseManager/IECStateMachine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,17 @@ void IECStateMachine::connector_unlock() {
}

void IECStateMachine::connector_force_unlock() {
force_unlocked = true;
RawCPState cp;

{
Everest::scoped_lock_timeout lock(state_machine_mutex, Everest::MutexDescription::IEC_force_unlock);
cp = cp_state;
}

if (cp == RawCPState::B or cp == RawCPState::C) {
force_unlocked = true;
check_connector_lock();
}
}

void IECStateMachine::check_connector_lock() {
Expand Down
3 changes: 3 additions & 0 deletions modules/EvseManager/scoped_lock_timeout.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ enum class MutexDescription {
IEC_set_pwm_off,
IEC_set_pwm_F,
IEC_allow_power_on,
IEC_force_unlock,
EVSE_set_ev_info,
EVSE_publish_ev_info,
EVSE_subscribe_DC_EVMaximumLimits,
Expand Down Expand Up @@ -171,6 +172,8 @@ static std::string to_string(MutexDescription d) {
return "IECStateMachine::set_pwm_F";
case MutexDescription::IEC_allow_power_on:
return "IECStateMachine::allow_power_on";
case MutexDescription::IEC_force_unlock:
return "IECStateMachine::force_unlock";
case MutexDescription::EVSE_set_ev_info:
return "EvseManager.cpp: set ev_info present_voltage/current";
case MutexDescription::EVSE_publish_ev_info:
Expand Down

0 comments on commit e0ebd57

Please sign in to comment.