Skip to content

Commit

Permalink
adjustment to make sure that we always use isDayPeriod when sunset …
Browse files Browse the repository at this point in the history
…is available
  • Loading branch information
AndreasBoehm committed Aug 8, 2024
1 parent 3bd5d5c commit 29cd05e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/PowerLimiter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,11 @@ void PowerLimiterClass::loop()
auto getBatteryPower = [this,&config]() -> bool {
if (config.PowerLimiter.IsInverterSolarPowered) { return false; }

auto isDayPeriod = (SunPosition.isSunsetAvailable() && SunPosition.isDayPeriod())
|| getSolarPower() > 0;
auto isDayPeriod = getSolarPower() > 0;

if (SunPosition.isSunsetAvailable()) {
isDayPeriod = SunPosition.isDayPeriod();
}

if (_nighttimeDischarging && isDayPeriod) {
_nighttimeDischarging = false;
Expand Down

0 comments on commit 29cd05e

Please sign in to comment.