Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[charging] Configurable charging hysteresis. Fixes JB#40062 #9

Merged
merged 2 commits into from Feb 22, 2022

Conversation

spiiroin
Copy link
Contributor

Keeping devices constantly connected to a charger (e.g. 24/7/365 in
case of devices used for running automated tests) can be detrimental
to battery health.

Make it possible to disable charging temporarily to reduce amount of time
devices are doing maintenance charging at close to battery full state.

Supported modes are:

  • enable: charging is always enabled
  • disable: charging is always disabled
  • apply-thresholds: disabled at disable limit/above and enabled at
    enable limit or below
  • apply-thresholds-after-full: enabled until battery full is reached,
    after which as with apply-thresholds

Enable/disable thresholds and operation mode can be modified during
runtime, for example with mcetool options:
--set-charging-mode=
--set-charging-enable-limit=
--set-charging-disable-limit=

How charging is enabled/disabled must be defined in mce configuration
file (see inifiles/charging.ini for details).

Signed-off-by: Simo Piiroinen simo.piiroinen@jolla.com

Python2 is deprecated and soon might not be available in sdk.

Signed-off-by: Simo Piiroinen <simo.piiroinen@jolla.com>
Copy link

@mlehtima mlehtima left a comment

Choose a reason for hiding this comment

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

There doesn't seem to be any validation whether the configured min and max values are in correct order but maybe that is not really important.

modules/charging.c Outdated Show resolved Hide resolved
@spiiroin
Copy link
Contributor Author

There doesn't seem to be any validation whether the configured min and max values are in correct order but maybe that is not really important.

enable_limit has priority, so enable_limit=60, disable_limit=50 --acts-like--> enable_limit=60, disable_limit=61

but it is a illogical situation -> probably it would be better to handle it more explicitly...

Keeping devices constantly connected to a charger (e.g. 24/7/365 in
case of devices used for running automated tests) can be detrimental
to battery health.

Make it possible to disable charging temporarily to reduce amount of time
devices are doing maintenance charging at close to battery full state.

Supported modes are:
- enable: charging is always enabled
- disable: charging is always disabled
- apply-thresholds: disabled at disable limit/above and enabled at
  enable limit or below
- apply-thresholds-after-full: enabled until battery full is reached,
  after which as with apply-thresholds

Enable/disable thresholds and operation mode can be modified during
runtime, for example with mcetool options:
      --set-charging-mode=<mode>
      --set-charging-enable-limit=<percent>
      --set-charging-disable-limit=<percent>

How charging is enabled/disabled must be defined in mce configuration
file (see inifiles/charging.ini for details).

Signed-off-by: Simo Piiroinen <simo.piiroinen@jolla.com>
@spiiroin
Copy link
Contributor Author

Review commits squashed and spec adjusted to have:
BuildRequires: pkgconfig(mce) >= 1.30.0

@spiiroin spiiroin merged commit db5b919 into sailfishos:master Feb 22, 2022
@spiiroin spiiroin deleted the jb40062_charging_hysteresis branch February 22, 2022 02:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants