Skip to content

Commit

Permalink
fix: prevent overriding disable state on startup
Browse files Browse the repository at this point in the history
Signed-off-by: James Chapman <[email protected]>
  • Loading branch information
james-ctc committed May 17, 2024
1 parent 7c387e1 commit 451ee5d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion modules/EvseManager/Charger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@ void Charger::run_state_machine() {
auto time_in_current_state =
std::chrono::duration_cast<std::chrono::milliseconds>(now - internal_context.current_state_started).count();

// std::cout << "Charger::run_state_machine: " << evse_state_to_string(shared_context.current_state) <<
// std::endl;

switch (shared_context.current_state) {
case EvseState::Disabled:
if (initialize_state) {
Expand Down Expand Up @@ -762,7 +765,10 @@ void Charger::process_event(CPEvent cp_event) {
run_state_machine();

// Process all event actions that are independent of the current state
process_cp_events_independent(cp_event);
// except when disabled
if (shared_context.current_state != EvseState::Disabled) {
process_cp_events_independent(cp_event);
}

run_state_machine();

Expand Down

0 comments on commit 451ee5d

Please sign in to comment.