FrameworkComputer / EmbeddedController

Embedded Controller firmware for the Framework Laptop
BSD 3-Clause "New" or "Revised" License
957 stars 64 forks source link

hx20: CHG_LIMIT_GET_LIMIT disables charge override #6

Closed DHowett closed 1 year ago

DHowett commented 2 years ago

Querying the charge limit with host command CHARGE_LIMIT_CONTROL mode CHG_LIMIT_GET_LIMIT reloads the charge limit from bbram, which overwrites the CHG_LIMIT_OVERRIDE flag.

Flag is set here (and not stored to bbram, because it is a one-time override):

https://github.com/FrameworkComputer/EmbeddedController/blob/6e38e82b9553240820c241c80a7d94fdc3ae5914/board/hx20/battery.c#L362-L363

and cleared when we read into charging_maximum_level here:

https://github.com/FrameworkComputer/EmbeddedController/blob/6e38e82b9553240820c241c80a7d94fdc3ae5914/board/hx20/battery.c#L365-L366