Skip to content

Avoid resetting charge_max_level during CHG_LIMIT_GET_LIMIT - #7

Merged
kiram9 merged 4 commits into
FrameworkComputer:hx20-hx30from
DHowett:dh/bug/6
May 26, 2023
Merged

kiram9 merged 4 commits into
FrameworkComputer:hx20-hx30from
DHowett:dh/bug/6

Conversation

@DHowett

@DHowett DHowett commented Jan 23, 2022

Copy link
Copy Markdown

Reading into charging_maximum_level overwrites CHG_LIMIT_OVERRIDE;
GET_LIMIT should not change global state.

Fixes #6.

Comment thread board/hx20/battery.c Outdated
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;

Copy link
Copy Markdown

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
Copy Markdown
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!

@github-actions

github-actions Bot commented Jun 14, 2022 •

Copy link
Copy Markdown

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@DHowett

DHowett commented Jun 14, 2022

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

kiram9 added a commit that referenced this pull request Jun 14, 2022
@DHowett

DHowett commented Jun 14, 2022

Copy link
Copy Markdown
Author

I'm not certain about the "labeler" failure:

Error: HttpError: Resource not accessible by integration
Error: Resource not accessible by integration

@kiram9
kiram9 changed the base branch from hx20 to hx20-hx30 January 5, 2023 00:09
@DHowett

DHowett commented Jan 5, 2023

Copy link
Copy Markdown
Author

Moved this over to baseboard/fwk. Thanks again for doing all the baseboard stuff, folks 😄

@DHowett DHowett changed the title Do not reset charge_max_level during CHG_LIMIT_GET_LIMIT Avoid resetting charge_max_level during CHG_LIMIT_GET_LIMIT Jan 5, 2023
@kiram9
kiram9 merged commit 72748b7 into FrameworkComputer:hx20-hx30 May 26, 2023
@github-actions github-actions Bot locked and limited conversation to collaborators May 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

hx20: CHG_LIMIT_GET_LIMIT disables charge override

3 participants