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:
parent
9c3482b1d5
commit
8345775de0
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue