Skip to content

Commit fd5ae7e

Browse files
committed
Fix some race condition with shaper disabling while divert is on
1 parent e31faf5 commit fd5ae7e

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/current_shaper.cpp

Lines changed: 1 addition & 4 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);
@@ -104,11 +104,8 @@ void CurrentShaperTask::setState(bool state) {
104104
}
105105

106106
void CurrentShaperTask::shapeCurrent() {
107-
// only use Shaper if there's no Divert claim active ( means divert is active)
108-
if (!_evse->clientHasClaim(EvseClient_OpenEVSE_Divert)) {
109107
_chg_cur = round(((_max_pwr - _live_pwr) / evse.getVoltage()) + (evse.getAmps()));
110108
_changed = true;
111-
}
112109
}
113110

114111
int CurrentShaperTask::getMaxPwr() {

0 commit comments

Comments
 (0)