Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Do not reset charge_max_level during CHG_LIMIT_GET_LIMIT
Fixes #6.
  • Loading branch information
DHowett committed Jan 23, 2022
commit 54525158d2bf110391202190f62a61556bd6a0e5
5 changes: 3 additions & 2 deletions board/hx20/battery.c
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,9 @@ static enum ec_status cmd_charging_limit_control(struct host_cmd_handler_args *a
charging_maximum_level = charging_maximum_level | CHG_LIMIT_OVERRIDE;

if (p->modes & CHG_LIMIT_GET_LIMIT) {
system_get_bbram(SYSTEM_BBRAM_IDX_CHG_MAX, &charging_maximum_level);
r->max_percentage = charging_maximum_level;
uint8_t max = 0;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fwiw I think the code style here is to declare all variables at the beginning of the function

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair. I was iffy on whether I wanted to introduce a temporary anyway, given that ec_response_chg_limit_control::max_percentage is itself a uint8_t. I switched over to reading directly into it.

This may cause a compat problem if the response from this command ever changes, but the correct way to handle that would be with a new command version anyway . . . 😄

Thanks!

system_get_bbram(SYSTEM_BBRAM_IDX_CHG_MAX, &max);
r->max_percentage = max;
args->response_size = sizeof(*r);
}

Expand Down