Skip to content

Commit

Permalink
DPL: address overflow issue when testing backoff
Browse files Browse the repository at this point in the history
  • Loading branch information
schlimmchen committed Nov 17, 2024
1 parent e586446 commit 59ab971
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/PowerLimiter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,7 @@ void PowerLimiterClass::loop()

// since _lastCalculation and _calculationBackoffMs are initialized to
// zero, this test is passed the first time the condition is checked.
// TODO(schlimmchen): not wrap-around safe
if (millis() < (_lastCalculation + _calculationBackoffMs)) {
if ((millis() - _lastCalculation) < _calculationBackoffMs) {
return announceStatus(Status::Stable);
}

Expand Down

0 comments on commit 59ab971

Please sign in to comment.