Skip to content

Commit 5bc2d07

Browse files
marc-cpdesignkartben
authored andcommitted
sensor: shell_battery: fix current value display
The sensor interface gives current channel values in Amps, but the "I" (current) value is displayed in mA, so needs to be converted accordingly. Signed-off-by: Marc Reilly <[email protected]>
1 parent c0c757d commit 5bc2d07

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/sensor/shell_battery.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ static int cmd_battery(const struct shell *sh, size_t argc, char **argv)
9494
volt.val1, volt.val2 / 10000);
9595
shell_print(sh, "V-desired: %d.%02d V",
9696
v_desired.val1, v_desired.val2 / 10000);
97-
shell_fprintf_normal(sh, "I: %d mA", current.val1);
97+
shell_fprintf_normal(sh, "I: %lld mA",
98+
sensor_value_to_milli(&current));
9899
if (current.val1 > 0) {
99100
shell_fprintf_normal(sh, " (CHG)");
100101
} else if (current.val1 < 0) {

0 commit comments

Comments
 (0)