Skip to content

Commit

Permalink
Fix excessive updates when max current has full amp steps (evcc-io#7494)
Browse files Browse the repository at this point in the history
  • Loading branch information
andig authored Apr 16, 2023
1 parent f010bdd commit a094b85
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions core/loadpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -645,13 +645,17 @@ func (lp *Loadpoint) syncCharger() {

// setLimit applies charger current limits and enables/disables accordingly
func (lp *Loadpoint) setLimit(chargeCurrent float64, force bool) error {
// full amps only?
if _, ok := lp.charger.(api.ChargerEx); !ok || lp.vehicleHasFeature(api.CoarseCurrent) {
chargeCurrent = math.Trunc(chargeCurrent)
}

// set current
if chargeCurrent != lp.chargeCurrent && chargeCurrent >= lp.GetMinCurrent() {
var err error
if charger, ok := lp.charger.(api.ChargerEx); ok && !lp.vehicleHasFeature(api.CoarseCurrent) {
if charger, ok := lp.charger.(api.ChargerEx); ok {
err = charger.MaxCurrentMillis(chargeCurrent)
} else {
chargeCurrent = math.Trunc(chargeCurrent)
err = lp.charger.MaxCurrent(int64(chargeCurrent))
}

Expand Down

0 comments on commit a094b85

Please sign in to comment.