Skip to content

Commit

Permalink
Limit to ev_max_current/voltage if target is higher (#888)
Browse files Browse the repository at this point in the history
* Limit to ev_max_current/voltage if target is higher

Signed-off-by: Cornelius Claussen <cc@pionix.de>
  • Loading branch information
corneliusclaussen authored and hikinggrass committed Oct 7, 2024
1 parent 8575d34 commit bef8a40
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions modules/EvseManager/EvseManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,18 @@ void EvseManager::ready() {
if (config.hack_skoda_enyaq and (v.dc_ev_target_voltage < 300 or v.dc_ev_target_current < 0))
return;

// Limit voltage/current for broken EV implementations
const auto ev = get_ev_info();
if (ev.maximum_current_limit.has_value() and
v.dc_ev_target_current > ev.maximum_current_limit.value()) {
v.dc_ev_target_current = ev.maximum_current_limit.value();
}

if (ev.maximum_voltage_limit.has_value() and
v.dc_ev_target_voltage > ev.maximum_voltage_limit.value()) {
v.dc_ev_target_voltage = ev.maximum_voltage_limit.value();
}

if (v.dc_ev_target_voltage not_eq latest_target_voltage or
v.dc_ev_target_current not_eq latest_target_current) {
latest_target_voltage = v.dc_ev_target_voltage;
Expand Down

0 comments on commit bef8a40

Please sign in to comment.