Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always try to unlock the Connector, as long as the relays are not on #962

Merged
merged 3 commits into from
Dec 3, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions modules/EvseManager/IECStateMachine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -505,17 +505,26 @@ void IECStateMachine::connector_force_unlock() {
cp = cp_state;
}

if (not relais_on) {
// Unconditionally try to unlock, as `is_locked` might not always reflect the physical state of the lock.
// This can occur for example in case of a failed unlock due to a hardware issue.
signal_unlock();
is_locked = false;
}

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

void IECStateMachine::check_connector_lock() {
if (should_be_locked and not force_unlocked and not is_locked) {
ydankner marked this conversation as resolved.
Show resolved Hide resolved
bool should_be_locked_considering_relais_and_force = relais_on or (should_be_locked and not force_unlocked);

if (not is_locked and should_be_locked_considering_relais_and_force) {
signal_lock();
is_locked = true;
} else if ((not should_be_locked or force_unlocked) and is_locked and not relais_on) {
} else if (is_locked and not should_be_locked_considering_relais_and_force) {
signal_unlock();
is_locked = false;
}
Expand Down
Loading