Skip to content

Commit

Permalink
make calcPowerLimit respect DTU poll interval
Browse files Browse the repository at this point in the history
  • Loading branch information
MalteSchm committed Apr 7, 2023
1 parent f84bdf7 commit 734d34b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/PowerLimiter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,9 @@ int32_t PowerLimiterClass::calcPowerLimit(std::shared_ptr<InverterAbstract> inve

// Safety check, return on too old power meter values
if (millis() - PowerMeter.getLastPowerMeterUpdate() < (30 * 1000)
&& millis() - inverter->Statistics()->getLastUpdate() < (15 * 1000)) {
// If the power meter values are older than 30 seconds,
&& millis() - inverter->Statistics()->getLastUpdate() < (config.Dtu_PollInterval * 3 * 1000)) {
// If the power meter values are older than 30 seconds,
// and the Inverter Stats are older then 3x the poll interval
// set the limit to config.PowerLimiter_LowerPowerLimit for safety reasons.
MessageOutput.println("[PowerLimiterClass::loop] Power Meter values too old. Using lower limit");
return config.PowerLimiter_LowerPowerLimit;
Expand Down

0 comments on commit 734d34b

Please sign in to comment.