-
Notifications
You must be signed in to change notification settings - Fork 511
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
Allow power manager to disable charging #2257
Conversation
I'll let Guo-Hui and Andrey review. This is beyond my knowledge to meaningfully review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mainly due to dynalib change and ABI problem with getConfig()
.
assertEqual(cfg.getPowerSourceMinVoltage(), particle::power::DEFAULT_INPUT_VOLTAGE_LIMIT); | ||
assertEqual(cfg.getBatteryChargeCurrent(), particle::power::DEFAULT_CHARGE_CURRENT); | ||
assertEqual(cfg.getBatteryChargeVoltage(), particle::power::DEFAULT_TERMINATION_VOLTAGE); | ||
|
||
assertEqual(System.batteryState(), (int)BATTERY_STATE_UNKNOWN); | ||
assertEqual(System.powerSource(), (int)POWER_SOURCE_UNKNOWN); | ||
// Restore default power management configuration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: (can be a separate PR) let's add three tests 1) disable/enable charging in runtime and verifying configuration and actual PMIC state 2) disable/enable charging, resetting and making sure that the necessary charging state is set on boot 3) disable/enable chargin, triggering PMIC watchdog and making sure that the necessary charging state is achieved after watchdog timer expires.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I'm still testing some of this code so I didn't add the tests here yet.
3f17480
to
62444ee
Compare
62444ee
to
e74d98e
Compare
f0b1284
to
7e6496d
Compare
Problem
The power manager may override user requests to disable battery charging. While the user may set the charge state on the PMIC, the power manager may enable charge state silently.
Solution
Add a flag for non-volatile power management configuration that ensures that the power manager honor user requests to disable charging. Additionally create get methods for the configuration so that the user can query the current configuration.
Steps to Test
Which unit/integration/application tests are applicable to this code change? (At minimum a test of some kind should be provided)
Example App
References
N/A
Completeness