diff options
author | Daisuke Nojiri <dnojiri@chromium.org> | 2021-06-30 17:25:31 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-07-02 22:04:30 +0000 |
commit | f281dad60e108a5d9d0b6047b4a649af67afaa09 (patch) | |
tree | 2c5e538e8756fd9c028b589bf089b8090e532930 | |
parent | cb8fcbb2f26671d6e7e7abdc9a7c553ebb16026b (diff) | |
download | chrome-ec-f281dad60e108a5d9d0b6047b4a649af67afaa09.tar.gz |
Battery: Print display SoC in proper position for battery command
Currently, the battery command prints the display SoC between
'Cap-full' and 'Design', breaking the semantic link between them.
Cap-full: 5492 mAh
Display: 100.0 % <-- wrong position
Design: 5470 mAh
This patch makes the command print the display SoC under 'Charge'.
Charge: 89 %
Display: 91.6 %
BUG=None
BRANCH=None
TEST=Storo.
Change-Id: I13010732fc243d278e227d6f80a5a4feecb320b0
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3001186
Reviewed-by: Philip Chen <philipchen@chromium.org>
-rw-r--r-- | common/battery.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/common/battery.c b/common/battery.c index 3e8b06f971..ecb1152df1 100644 --- a/common/battery.c +++ b/common/battery.c @@ -176,6 +176,14 @@ static void print_battery_params(void) print_item_name("Charge:"); ccprintf("%d %%\n", batt->state_of_charge); + + if (IS_ENABLED(CONFIG_CHARGER)) { + int value; + + print_item_name(" Display:"); + value = charge_get_display_charge(); + ccprintf("%d.%d %%\n", value / 10, value % 10); + } } static void print_battery_info(void) @@ -207,12 +215,6 @@ static void print_battery_info(void) if (check_print_error(battery_full_charge_capacity(&value))) ccprintf("%d mAh\n", value); -#ifdef CONFIG_CHARGER - print_item_name("Display:"); - value = charge_get_display_charge(); - ccprintf("%d.%d %%\n", value / 10, value % 10); -#endif - print_item_name(" Design:"); if (check_print_error(battery_design_capacity(&value))) ccprintf("%d mAh\n", value); |