Skip to content

Commit

Permalink
Merge pull request #534 from KipK/threephase
Browse files Browse the repository at this point in the history
fix current shaper for threephase + amp display
  • Loading branch information
jeremypoulter authored Jan 30, 2023
2 parents 986483e + b6c0e8f commit 751d837
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
7 changes: 5 additions & 2 deletions src/current_shaper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,18 @@ void CurrentShaperTask::shapeCurrent() {
_updated = true;
// adding self produced energy to total
int max_pwr = _max_pwr;
if (config_divert_enabled()) {
if (config_divert_enabled() == true) {
if (mqtt_solar != "") {
max_pwr += solar;
}
else if (mqtt_grid_ie != "" && (grid_ie <= 0)) {
max_pwr -= grid_ie;
}
}
_max_cur = round(((max_pwr - _live_pwr) / evse.getVoltage()) + (evse.getAmps()));
if(!config_threephase_enabled())
_max_cur = round(((max_pwr - _live_pwr) / evse.getVoltage()) + (evse.getAmps()));
else
_max_cur = round(((max_pwr - _live_pwr) / evse.getVoltage() / 3) + (evse.getAmps()));


_changed = true;
Expand Down
7 changes: 1 addition & 6 deletions src/evse_man.h
Original file line number Diff line number Diff line change
Expand Up @@ -339,12 +339,7 @@ class EvseManager : public MicroTasks::Task
return _monitor.isCharging();
}
double getAmps() {
if (!config_threephase_enabled()) {
return _monitor.getAmps();
}
else {
return _monitor.getAmps() * 3;
}
return _monitor.getAmps();
}
double getVoltage() {
return _monitor.getVoltage();
Expand Down

0 comments on commit 751d837

Please sign in to comment.