Change CapacityMode from 2 (%) to 1 (mWh)
This fixes #11 by also reporting battery capacity percentage on Windows laptops that already has a battery. This makes the sample more interesting to demonstrate.
The CapacityMode units are documented in Usage Tables for HID Power Devices section 4.2.3 Battery Controls.
The total battery charge % reported by Windows appear to be a weighted sum of each battery, weighted by their respective capacities. The Arduino battery is currently harcoded to iFullChargeCapacity = 100 mWh, which is quite small. It does therefore have a relatively low influence on the total battery charge % on the laptop I've tested on.
Screenshots of 84% charge
On Windows, the Arduino appear as an additional battery with a separate charge %:
On MacOS the Arduino appear as a UPS battery with a separate charge %:
On Fedora Linux the Arduino appears as a UPS battery with separate charge %:
Test setup
Arduino micro on breadboard with a potentiometer connected to A7:
The bCharging variable is hardcoded, since I haven't connected any digital switch.
I also had to update linux/98-upower-hid.rules with ATTRS{idProduct}=="8037" to make Linux recognize the Arduino micro.
@abratchik Would it be possible for you to take a look at this PR?
The reason for proposing this change is to make the project appear more interesting and impressive "out of the box" for new developers that have not yet investigated all details.
HI @forderud , as I mentioned above, changing the default will have effect on existing implementations. Having another battery for a Windows laptop is not the main use case for this library. You wrote an excellent manual so I think it makes sense to place it in Readme for those who still want to see 2 batteries in the Windows tray properly reflecting the remaining capacity.
HI @forderud , as I mentioned above, changing the default will have effect on existing implementations. Having another battery for a Windows laptop is not the main use case for this library. You wrote an excellent manual so I think it makes sense to place it in Readme for those who still want to see 2 batteries in the Windows tray properly reflecting the remaining capacity.
Understood. I've now submitted #18 for updating the readme as proposed.
Not accepted as changing defaults for Windows in order to support a special case (ACPI battery present) will break Linux and Mac compatibility.