Skip to content

Commit e3f5e1f

Browse files
fabiobaltiericarlescufi
authored andcommitted
sensor: bq274xx: fix few data units
Change few data units that are currently reported three order of magnitude off from what the sensors API specifies. Signed-off-by: Fabio Baltieri <[email protected]>
1 parent 5d1a4d4 commit e3f5e1f

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

drivers/sensor/bq274xx/bq274xx.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -458,28 +458,28 @@ static int bq274xx_channel_get(const struct device *dev, enum sensor_channel cha
458458
break;
459459

460460
case SENSOR_CHAN_GAUGE_FULL_CHARGE_CAPACITY:
461-
val->val1 = (data->full_charge_capacity / 1000);
462-
val->val2 = ((data->full_charge_capacity % 1000) * 1000U);
461+
val->val1 = data->full_charge_capacity;
462+
val->val2 = 0;
463463
break;
464464

465465
case SENSOR_CHAN_GAUGE_REMAINING_CHARGE_CAPACITY:
466-
val->val1 = (data->remaining_charge_capacity / 1000);
467-
val->val2 = ((data->remaining_charge_capacity % 1000) * 1000U);
466+
val->val1 = data->remaining_charge_capacity;
467+
val->val2 = 0;
468468
break;
469469

470470
case SENSOR_CHAN_GAUGE_NOM_AVAIL_CAPACITY:
471-
val->val1 = (data->nom_avail_capacity / 1000);
472-
val->val2 = ((data->nom_avail_capacity % 1000) * 1000U);
471+
val->val1 = data->nom_avail_capacity;
472+
val->val2 = 0;
473473
break;
474474

475475
case SENSOR_CHAN_GAUGE_FULL_AVAIL_CAPACITY:
476-
val->val1 = (data->full_avail_capacity / 1000);
477-
val->val2 = ((data->full_avail_capacity % 1000) * 1000U);
476+
val->val1 = data->full_avail_capacity;
477+
val->val2 = 0;
478478
break;
479479

480480
case SENSOR_CHAN_GAUGE_AVG_POWER:
481-
val->val1 = (data->avg_power / 1000);
482-
val->val2 = ((data->avg_power % 1000) * 1000U);
481+
val->val1 = data->avg_power;
482+
val->val2 = 0;
483483
break;
484484

485485
default:

0 commit comments

Comments
 (0)