-
Notifications
You must be signed in to change notification settings - Fork 36
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
Change CapacityMode from 2 (%) to 1 (mWh) #14
Conversation
24f2a1b
to
e840dde
Compare
This fixes abratchik#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](https://www.usb.org/sites/default/files/pdcv11.pdf) 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.
e840dde
to
3743e0a
Compare
@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. |
…g batteries See abratchik#11 and abratchik#14 for background.
Understood. I've now submitted #18 for updating the readme as proposed. |
…g batteries See abratchik#11 and abratchik#14 for background.
…g batteries See abratchik#11 and abratchik#14 for background.
Not accepted as changing defaults for Windows in order to support a special case (ACPI battery present) will break Linux and Mac compatibility. |
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
withATTRS{idProduct}=="8037"
to make Linux recognize the Arduino micro.