summaryrefslogtreecommitdiff
path: root/driver/battery/smart.c
diff options
context:
space:
mode:
Diffstat (limited to 'driver/battery/smart.c')
-rw-r--r--driver/battery/smart.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/driver/battery/smart.c b/driver/battery/smart.c
index 2c67de9030..b2ce08e782 100644
--- a/driver/battery/smart.c
+++ b/driver/battery/smart.c
@@ -283,7 +283,6 @@ test_mockable int battery_device_chemistry(char *dest, int size)
return sb_read_string(SB_DEVICE_CHEMISTRY, dest, size);
}
-#ifdef CONFIG_CMD_PWR_AVG
int battery_get_avg_current(void)
{
int current;
@@ -293,6 +292,7 @@ int battery_get_avg_current(void)
return (int16_t)current;
}
+#ifdef CONFIG_CMD_PWR_AVG
/*
* Technically returns only the instantaneous reading, but tests showed that
* for the majority of charge states above 3% this varies by less than 40mV
@@ -332,6 +332,8 @@ void battery_get_params(struct batt_params *batt)
else
batt_new.current = (int16_t)v;
+ if (sb_read(SB_AVERAGE_CURRENT, &v))
+ batt_new.flags |= BATT_FLAG_BAD_AVERAGE_CURRENT;
if (sb_read(SB_CHARGING_VOLTAGE, &batt_new.desired_voltage))
batt_new.flags |= BATT_FLAG_BAD_DESIRED_VOLTAGE;