Quote:
Originally Posted by Unknownforce
av_index is used for identifying the proper temperature being pulled from the temperature array listed in htc_battery_smem.h, There are 1347 entries in that array. This is why it says if the av_index is higher than this, than it would cause the battery to freeze because it's trying to pull a value beyond the size of the array.
It has no correlation to the battery capacity.
Trust me if it were that easy, the Devs would have already had it working long ago.
The calculations I am using are very close, but they are just not as accurate as they should be. And there ARE no calculations that keep the battery level STABLE under different discharge/load levels at the current time. In just what little I have gathered from my limited disassembly of the battery.dll, it looks like there are 2 different ways it calculates the battery based on whether or not it's discharging or charging, (which is kind of what I have done in the 6/4 update) and then inside that there's multiple battery percentages it stores... One is a "stabilized" reading, another is a "immediate" reading, and another I believe is used in the stabilizing process, most likely a "previous" percentage used to "average" the battery level... So probably the only thing left to do on this is to just stabilize the load to percentage ratio and give it a condition to NEVER go up in percentage if it's NOT charging. But the current code doesn't seem to take load into consideration very well.
|
Sorry...never updated my post. I realized what av_index is after looking into the code some more. You know, you are trying to do something about the increase while charging, but most devices I have used just display some type of animation while charging and then display the percentage again when it is unplugged.
About keeping stable under varying loads, There is a solution that uses the output impedance of the battery. I am in the (slow) process of compiling the data to plot a curve for the output resistance as a factor of battery temperature. If one knows this curve it is painless to calculate the correct percentage of charge. I'll share it with you when I get it done. I haven't had much time to dedicate to it yet...