fuel_gauge: sbs_gauge: fix negative currents

Fix negative currents being read as extremely high currents due to
unsigned variable use.

Signed-off-by: Jordan Yates <jordan@embeint.com>
This commit is contained in:
Jordan Yates 2024-11-12 10:40:03 +10:00 committed by Anas Nashif
parent 9c3482b1d5
commit 8345775de0
1 changed files with 1 additions and 1 deletions

View File

@ -83,7 +83,7 @@ static int sbs_gauge_get_prop(const struct device *dev, fuel_gauge_prop_t prop,
break;
case FUEL_GAUGE_CURRENT:
rc = sbs_cmd_reg_read(dev, SBS_GAUGE_CMD_CURRENT, &tmp_val);
val->current = tmp_val * 1000;
val->current = (int16_t)tmp_val * 1000;
break;
case FUEL_GAUGE_FULL_CHARGE_CAPACITY:
rc = sbs_cmd_reg_read(dev, SBS_GAUGE_CMD_FULL_CAPACITY, &tmp_val);