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

Charger Auth state: Add some more warning logging #682

Merged
merged 1 commit into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
17 changes: 15 additions & 2 deletions modules/EvseManager/Charger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,9 @@ void Charger::run_state_machine() {
// to make sure control_pilot does not switch on relais even if
// we start PWM here
if (initialize_state) {
internal_context.pp_warning_printed = false;
internal_context.no_energy_warning_printed = false;

bsp->allow_power_on(false, types::evse_board_support::Reason::PowerOff);

if (internal_context.last_state == EvseState::Replug) {
Expand Down Expand Up @@ -264,6 +267,10 @@ void Charger::run_state_machine() {
shared_context.max_current_cable = bsp->read_pp_ampacity();
// retry if the value is not yet available. Some BSPs may take some time to measure the PP.
if (shared_context.max_current_cable == 0) {
if (not internal_context.pp_warning_printed) {
EVLOG_warning << "PP ampacity is zero, still retrying to read PP ampacity...";
internal_context.pp_warning_printed = true;
}
break;
}
}
Expand All @@ -274,6 +281,10 @@ void Charger::run_state_machine() {
// Create a copy of the atomic struct
types::iso15118_charger::DC_EVSEMaximumLimits evse_limit = shared_context.current_evse_max_limits;
if (not(evse_limit.EVSEMaximumCurrentLimit > 0 and evse_limit.EVSEMaximumPowerLimit > 0)) {
if (not internal_context.no_energy_warning_printed) {
EVLOG_warning << "No energy available, still retrying...";
internal_context.no_energy_warning_printed = true;
}
break;
}
}
Expand Down Expand Up @@ -302,8 +313,9 @@ void Charger::run_state_machine() {

// If we are restarting, the transaction may already be active
if (not shared_context.transaction_active) {
if (!start_transaction())
if (!start_transaction()) {
break;
}
}

const EvseState target_state(EvseState::PrepareCharging);
Expand Down Expand Up @@ -384,8 +396,9 @@ void Charger::run_state_machine() {
}
} else if (shared_context.authorized and shared_context.authorized_pnc) {

if (!start_transaction())
if (!start_transaction()) {
break;
}

const EvseState target_state(EvseState::PrepareCharging);

Expand Down
3 changes: 3 additions & 0 deletions modules/EvseManager/Charger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,9 @@ class Charger {
std::chrono::system_clock::time_point current_state_started;
EvseState last_state_detect_state_change;
EvseState last_state;

bool pp_warning_printed{false};
bool no_energy_warning_printed{false};
} internal_context;

// main Charger thread
Expand Down
Loading