Enabling/disabling charging in DeviceOS 3.0

Hi everyone!

Since the introduction of the power manager in DeviceOS 1.5.x it’s been necessary to fall back to the old PMIC API when enabling/disabling charging instead of using the new Power Manager.

With the release of DeviceOS 3.0 you can now en/disable charging right from the power manager.

I’ve created a quick and dirty demo app that you can refer to https://go.particle.io/shared_apps/608a98db456ab200168b553b. It toggles charging every 30s.

There is no ENABLE_CHARGING so when you want to resume charging, the power configuration must be re-set without the DISABLE feature flag.

The relevant PR is Allow power manager to disable charging by eberseth · Pull Request #2257 · particle-iot/device-os · GitHub but be aware that the example app is missing a ; and uses config where cfg is supposed to be.

I hope this helps someone!

And please remember that Device OS 2.x remains the LTS DeviceOS and the version we encourage most customers to be on. 3.x is the feature branch.