hx20: CHG_LIMIT_GET_LIMIT disables charge override (original) (raw)

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):

if (p->modes & CHG_LIMIT_OVERRIDE)
charging_maximum_level = charging_maximum_level | CHG_LIMIT_OVERRIDE;

and cleared when we read into charging_maximum_level here:

if (p->modes & CHG_LIMIT_GET_LIMIT) {
system_get_bbram(SYSTEM_BBRAM_IDX_CHG_MAX, &charging_maximum_level);