Skip to content

Commit f6ca6f5

Browse files
authored
Merge pull request #478 from KipK/shaper
prevent shaper to control charge_current if divert mode is active
2 parents a9d2547 + fd5ae7e commit f6ca6f5

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/current_shaper.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ void CurrentShaperTask::setup() {
1818
}
1919

2020
unsigned long CurrentShaperTask::loop(MicroTasks::WakeReason reason) {
21-
if (_enabled) {
21+
if (_enabled && !_evse->clientHasClaim(EvseClient_OpenEVSE_Divert)) {
2222
EvseProperties props;
2323
if (_changed) {
2424
props.setChargeCurrent(_chg_cur);
@@ -97,7 +97,6 @@ void CurrentShaperTask::setState(bool state) {
9797
if (!_enabled) {
9898
//remove claim
9999
evse.release(EvseClient_OpenEVSE_Shaper);
100-
101100
}
102101
StaticJsonDocument<128> event;
103102
event["shaper"] = state?1:0;
@@ -106,7 +105,7 @@ void CurrentShaperTask::setState(bool state) {
106105

107106
void CurrentShaperTask::shapeCurrent() {
108107
_chg_cur = round(((_max_pwr - _live_pwr) / evse.getVoltage()) + (evse.getAmps()));
109-
_changed = true; // update claim in the loop
108+
_changed = true;
110109
}
111110

112111
int CurrentShaperTask::getMaxPwr() {

src/web_server.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ void buildStatus(DynamicJsonDocument &doc) {
241241
doc["divert_update"] = (millis() - divert.getLastUpdate()) / 1000;
242242
doc["divert_active"] = divert.isActive();
243243

244-
doc["shaper"] = shaper.isActive()?1:0;
244+
doc["shaper"] = shaper.getState()?1:0;
245245
doc["shaper_live_pwr"] = shaper.getLivePwr();
246246
doc["shaper_chg_cur"] = shaper.getChgCur();
247247

0 commit comments

Comments
 (0)