-
-
Notifications
You must be signed in to change notification settings - Fork 547
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
Improvements to battery monitoring #1158
base: master
Are you sure you want to change the base?
Improvements to battery monitoring #1158
Conversation
@EMN-CSharp checked it on my ARM tablet, temperature readings seems to be in 1/1000 Celsius, but it can be quirk of my device. It seems to react to battery cooling (applying cold gel pack, see image). I will test on other laptops I have to see if 1000 multiplier is permanent.
|
@inckie Thank you for testing it! |
@EMN-CSharp if something is in 10ths, its means resolution of 0.1, you definitely need to divide by 10.0f, not multiply. Then after subtracting it should actually bring temperature range to correct 2 digit range. |
The returned temperature value must be divided, not multiplied.
@inckie Oh, thanks for clarifying it. I misunderstood it as if the temperature was divided into tenths. Subtraction by 273.15 is already done. |
@EMN-CSharp yes, now it makes more sense, seems legit. |
Tested with VP1200ELCD UPS and looks better now. There is also random symbols with random length in device name (after name), with your PR and with official branch. |
Sorry for the late response, I haven't had enough time lately.
I just implemented that.
That's interesting. Microsoft's documentation says that battery device name and manufacturer are actually null-terminated strings. In any case, I fixed it (I think) by using the nOutBufferSize parameter of DeviceIoControl to know the size of the string in bytes, instead of relying on a terminator char. Hope it works properly now. |
This PR improves the following aspects of battery monitoring:
This is already tested, and prevents errors such as Battery update negative of minimum value overflows #976 from happening. In that case, the battery returned
BATTERY_UNKNOWN_RATE
(0x80000000), the same value asint.MinValue
.