View Single Post
  #33 (permalink)  
Old 06-02-2010, 03:28 PM
Unknownforce's Avatar
Unknownforce
PPCGeeks Regular
Offline
Threadstarter
 
Join Date: Nov 2008
Posts: 234
Reputation: 545
Unknownforce knows their stuffUnknownforce knows their stuffUnknownforce knows their stuffUnknownforce knows their stuffUnknownforce knows their stuffUnknownforce knows their stuff
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Re: Battery Meter and Temp reading "Fix" (workaround)

Quote:
Originally Posted by bhuggins View Post
Where does one get the source htc_battery_smem.c for the calculations? Where is it located in the tree while in android? I was curious about the calculations to see where the accuracy problem is. Does it have to do with temperature compensation? That right there would probably be different than the Raphael... I am using the latest stuff from Reefermattness along with your workaround and it is working so far, just not accurate.

Using Tilt2...

EDIT: Just tried a find in Terminal Emulator and didn't get a result
The source is here: http://gitorious.org/linux-on-qualco...battery_smem.c

What I changed is the static int function called htc_rhod_batt_corr here: http://pastie.org/989450

All I really did was use a little common sense, when the topaz fix was released, I looked at the code that was changed, and basically just did a little testing. I set it to think that it was a topaz, which made the battery report 100 all the time, Then I noticed that the mV readings were way off, so I just adjusted the numbers to get it to show that number to be a little closer to accurate, and in doing this, I discovered that the battery level would also show somewhat close to accurate because apparently the current code seems to directly relate the two (battery % and mV readings) As such, when you plug your phone in, the %age jumps WAY up because the mV readings increase dramatically. I've been thinking about writing some kind of stabilization code to lower the % reading based on status of charging and the increase in mV readings to help stabilize the %age number, but it's been so long since I've done any type of these kinds of Mathematics, I have to do much testing in order to get a proper table in which to write some formula to correctly stabilize it...

Something like if charging = 1 and mV = a certain range, than adjust the % reading to xyz.. But this would only be a "workaround" for another workaround. what we really need are the exact calculations from the battery driver itself. I'm slowly learning ARM ASM to accomplish this, but I've been working 2 jobs, so when I get in the "groove" so-to-speak, it gets interrupted and I have to re-start my train of thought from the beginning... it's very frustrating...
__________________

Phone: Sprint HTC EVO 3D
ROM: Synergy Nightly with Own Mods
"If you have the stereo on, why would you turn up the volume on the TV?" 'Cause I like to party

Last edited by Unknownforce; 06-02-2010 at 04:46 PM.
Reply With Quote
This post has been thanked 2 times.