From 94193714da6bac46fa22c2f043bee12cb82d35e7 Mon Sep 17 00:00:00 2001 From: andig Date: Tue, 27 Dec 2022 18:44:48 +0100 Subject: [PATCH] chore: correct variable name --- core/soc/estimator.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/soc/estimator.go b/core/soc/estimator.go index f014f67f2..552af9ee7 100644 --- a/core/soc/estimator.go +++ b/core/soc/estimator.go @@ -55,11 +55,11 @@ func (s *Estimator) Reset() { // RemainingChargeDuration returns the estimated remaining duration func (s *Estimator) RemainingChargeDuration(targetSoc int, chargePower float64) time.Duration { - hours := s.RemainingChargeEnergy(targetSoc) * 1e3 / chargePower - if math.IsInf(hours, 0) { - hours = 0 + energy := s.RemainingChargeEnergy(targetSoc) * 1e3 / chargePower + if math.IsInf(energy, 0) { + energy = 0 } - return time.Duration(float64(time.Hour) * hours).Round(time.Second) + return time.Duration(float64(time.Hour) * energy).Round(time.Second) } // RemainingChargeEnergy returns the remaining charge energy in kWh