Skip to content

Commit

Permalink
trailing mqtt_solar condition in current_shaper
Browse files Browse the repository at this point in the history
  • Loading branch information
KipK committed May 3, 2023
1 parent c3c68b7 commit def1758
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/current_shaper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,19 @@ unsigned long CurrentShaperTask::loop(MicroTasks::WakeReason reason) {
_evse->release(EvseClient_OpenEVSE_Shaper);
}
}


return EVSE_SHAPER_LOOP_TIME;
}

void CurrentShaperTask::begin(EvseManager &evse) {
this -> _timer = millis();
this -> _enabled = config_current_shaper_enabled();
this -> _evse = &evse;
this -> _max_pwr = current_shaper_max_pwr;
this -> _max_pwr = current_shaper_max_pwr;
this -> _live_pwr = 0;
this -> _max_cur = 0;
this -> _updated = false;
this -> _updated = false;
MicroTask.startTask(this);
StaticJsonDocument<128> event;
event["shaper"] = 1;
Expand Down Expand Up @@ -102,7 +102,7 @@ void CurrentShaperTask::setLivePwr(int live_pwr) {
shapeCurrent();
}

// temporary change Current Shaper state without changing configuration
// temporary change Current Shaper state without changing configuration
void CurrentShaperTask::setState(bool state) {
_enabled = state;
if (!_enabled) {
Expand All @@ -119,21 +119,21 @@ void CurrentShaperTask::shapeCurrent() {
// adding self produced energy to total
int max_pwr = _max_pwr;
if (config_divert_enabled() == true) {
if (mqtt_solar != "") {
if ( divert_type == _DIVERT_TYPE_SOLAR ) {
max_pwr += solar;
}
}
}
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;

_changed = true;
}

int CurrentShaperTask::getMaxPwr() {
Expand Down

0 comments on commit def1758

Please sign in to comment.