yashsingh1/xdaforums huggingface dataset:
[Nexus One Android Development] dvgrhl:
Yes, you have to be rooted. You also have to be running a compatible kernel, either cyanogen, pershoot, or wildmonks.

Edit: Actually, I should rephrase that. It is technically possible to run this app without root, but you do have to have one of those kernels. And to do any of the learn prep stuff you need root, though it is technically possible to hit learn mode without doing that.
[Nexus One Android Development] beatmania82:
Thank you very much.
[Nexus One Android Development] streamleaf:
Update for the calibration last night:

I left the phone on airplane mode for more than 4 hours for the learn cycle.

The data shown in 'battery monitor status' seems to suggest that the learn cycle went well, the last few data went like this:

21mA | 84%

20mA | 84%

19mA | 84%

19mA | 84%

19mA | 100%

0mA | 100%

However, after a manual power off-on, the age is not reset to 84%. I think that is what always makes my phone shut down by itself at around 15% battery left...

Can I manually set the age to 84% in the LearnPrep tab to complete the calibration cycle?

p/s: I' always get 0x83 instead of 0x81 at the end of the calibration, but guess this does not affect the success of calibration.

Thanks :)
[Nexus One Android Development] temasek:
You can.

Set age to 84% and monitor your draining using the app. You should be able to drain battery till 0%.

Btw, Age 80% means time to replace one. So get yourself ready to purchase one, maybe a 1600mAh battery :)
[Nexus One Android Development] streamleaf:
Thanks for the advice! Will get the wallet ready for the new batt :D

I'm now doing another calibration with 84% as the new age. Hopefully this is the last time ;)
[Nexus One Android Development] temasek:
Set age to 84% and you are set. No need to redo the learn cycle.

But monitor your battery draining when you reach low % just in case. You must be able to drain till 0%, if not your age is wrong.

Learn cycle to me is to enable the ability to drain your battery % down to the lowest, ie at 0%.

Battery Calibration for new batteries to me is to find out the max potential of its capacity and change its full40 accordingly, and at the same time perform a full learn cycle.

- Find out max potential of capacity thru a learn cycle, you will see your capacity overshoot your full40 before 100% battery. That is your potential max capacity and you should set your full40 near to that max level.

- Perform a proper learn cycle so as to have the ability to drain battery from 100% down to 0%
[Nexus One Android Development] redstar3894:
Yeah, hopefully someone will... :rolleyes:

Exactly... that's what I thought when looking over it... it looks fine... :confused:

Well... good luck guys... BTW, really awesome work here! :D
[Nexus One Android Development] dvgrhl:
OK, there is a market update available. This should fix all force close issues, even for people who aren't running a kernel with a modified driver. I tested it on the CM nightlies, pershoot kernel, and even the emulator. We're starting to improve the UI side of the app more too, which hopefully people will like. Please report any issues.
[Nexus One Android Development] chowlala:
What was the link again? Damn losing my time at work lately. Meh.

Just picked it up. Haha. Love the splash screen bro. And the UI is coming along excellently. Will toy with it more over the next few days. =)
[Nexus One Android Development] temasek:
Sold out! Hopefully its not due to my doing.............. :D

EDIT: Eh, its back online...........

http://cgi.ebay.com.sg/1600mAh-Li-i...ccessories&hash=item3f040274fa#ht_3089wt_1139

EDIT: Erm, maybe above link is not exactly the one I bought from, but I think its the same item.
[Nexus One Android Development] chowlala:
Hohoho. Ordered. Wonder how long it'll take to get here. Haha.

Btw, what were your settings again when you charged it up? Need to follow you but I lost track of the thread and too lazy to search. :P
[Nexus One Android Development] temasek:
My settings

Age 100

Empty Volt 3201mV

Full40 2500

Average Use = > 24 hrs per 100% charge

But I think you should perform a capacity test to see its full potential cuz there is a possibility that yours may not be the same, maybe better :p

I recommend grab some stats during last few % before it hits 100%, you max capacity should exceed the default full40. Once done, set your full40 to near the max capacity level before it hit 100% lvl and you are all set.

Is that a McDonald or BK slogon,.........."I'M LOVING IT" :D
[Nexus One Android Development] temasek:
Btw Roger set his 1600mAh rated battery @ full40 2550mAh.............. :eek:

That's 50mAh more than mine!!!!!! :mad:
[Nexus One Android Development] Skyheartblue:
Friends,

This tool looks like an amazing piece of work!!! But I must tell you, it is not that easy to understand how-to use for beginners...

I've read instructions and almost all posts here, still I have no clue on what to do first, how and why....

Will be fantastic if someone can spare the time to work on instructions step-by-step on how-to for really beginners.

It will take this project to a new level I believe.

Thanks any way great job!!!!!!!

JB
[Nexus One Android Development] temasek:
For a start I had no clue whatsoever also. So I kept asking questions and Roger & some others answered w/o a blink, for that I am grateful.

Back to your question. I believe you should read the 2 threads to have a clear understanding. Also in mtw4991's step-by-step instructions is a rather clear.

http://xdaforums.com/showpost.php?p=9583271&postcount=340

Any doubts or questions pls post here, we be glad to answer any. There are few rather season testers of this procedure and its battery application. :p
[Nexus One Android Development] chowlala:
Ok. I've ordered the battery.

And. My battery is going to be 2800 mAh! :D

Once it gets here, I'll begin calibrations and stuff. :)
[Nexus One Android Development] temasek:
I think the 2600mAh rated and above batteries will be out of business. LOL :D

High performance batteries within a stock battery cover of n1 ...YAY!

Frankly, without theloginwithnoname/RogerPodactor/dvgrhl hard work, I guess no one will ever find out that they bought a 1600mAh battery but its using 1452mAh as its full40. LMAO :p
[Nexus One Android Development] chowlala:
Yeah, this really changes the battery buying game and how we can make it work and even work better. Heck, it even changes the way we can actually test and measure our batteries. The calibration has been awesome! =)
[Nexus One Android Development] imfloflo:
Thanks for the fix with lastest cyanogen mod 6.1.1
[Nexus One Android Development] zen kun:
I back with my stock battery the 3000 was weird

Now a question the calibration should do it when almost die right?

And what happen if my setreg file its empty? Is totally blank nothing there how I should put the hex? Just

For example:

0x60 a4

There is no set aevolts or something in setreg thanks

.......................................................

Sent from my loved nexus one ;D
[Nexus One Android Development] temasek:
Its 0x66 a4 for setting empty voltage to 3201mV. As for setreg file, its suppose to be blank and you input the values and save it.
[Nexus One Android Development] RogerPodacter:
yeah when i got my 1600 battery this week, it was set to full40 of 1452, which is wrong. but when i charged it up to full, it went all the way to near 2500mAh. so these things are underprovisioned by about half usable capacity. i feel bad for anyone buying these and not in the know with this thread!

BTW, my first full day yesterday showed great battery times so far. i made it 9 hours with 3 hours screen on time, which is huge for me. and that was at 3.5 volts.

stock battery only made it like 6 hours.
[Nexus One Android Development] chowlala:
Whut?

I easily make 10-12 hours without charging per day on my stock battery. @_@

I'll be expecting to make 24 hours with the new one if it's got the same values you both have.
[Nexus One Android Development] RogerPodacter:
i hammer my phone very hard during the day. plus it sits in my cubicle with -107dBm signal strength non-stop:(.
[Nexus One Android Development] temasek:
Give new battery a break. In 1 weeks time its super charged. That's what happened to mine.

I can easily clock over 24 hrs in 1 charge now.
[Nexus One Android Development] theloginwithnoname:
= WANT!

Anyone know any UK suppliers doing it proper cheap??
[Nexus One Android Development] waylo:
I've been following this thread for a while, but the exact technical details have eluded me a bit. So I apologize if the following questions were addressed earlier, or appear way simple, or my comprehension is flawed:

1. Does calibrating the battery or changing the registers allow us to do "bump" charging without turning on/off the phone repeatedly, etc.?

2. I 'calibrated' my battery a while ago using the technique described here a while ago before the app was available (run it down, plug it in right before it shuts down, let it charge with the phone turned off). My battery age went from 94% (not calibrated) to 85% (calibrated). Isn't this just as good as what the app does?

Thanks all involved for your fantastic efforts in getting this app to the masses.
[Nexus One Android Development] RogerPodacter:
i got the 19.99USD one from htcrepairparts.com, with only like 4 bucks for the shipping. they are based in hong kong, but mine was at my door step in 7 days flat, so it may be worth going thru them.

this battery just looks like a quality battery physically, and it doesnt have any of those hard-coded FF registers, they all work. so it was a good buy IMO.

i guess a few people are getting the similar 1600 off ebay for 10 bucks, but i didnt mind paying the slight difference. this thing is performing well for me so far. makes it thru my whole work day with some to spare. stock couldnt barely do that.
[Nexus One Android Development] RogerPodacter:
you are "bump" charging it by changing register 0x65 from <80 down to <20mA. this let's it squeeze in that extra capacity that bump charging does, but it incorporates the added juice into your percent meter, so it won't stay above 100% for 2 hours like bump charging does. but that was just tricking your meter anyway, so its really the same thing.

yes it's the same thing, but its very rare to get the shut down method to actually work. the app let's you do the calibration with the phone on so you can see it happening. but its the same thing, if your age is 85% then that's not gonna change for now..
[Nexus One Android Development] RogerPodacter:
for sure. and besides each usage pattern is gonna be relative to how the person uses the phone. and trust me getting 9 hours with my usage is pretty good!
[Nexus One Android Development] EnhancerFIN:
Now that you guys have made the big job with the app, maybe I'll start developing bluetooth controlled wall socket relay, for automatic learning ;)

The point was, thanks for the app!

Though got to say, that battery maniacs like everyone in here should try going to 2G with wifi and mobile data switched off while screen is off. Doubled the battery life for me, and still I made the tasker profiles so that it turns data on every 30mins to sync everything and sniffs every 15min for a known wifi if sees one stays connected to it with wifi enabled. For me, I also configured it so that if the 2G signal stays bad for too long, it switches to 3G auto, and when wifi is connected it forces 2G also.

My point is not advertise tasker, just to make sure everyone knows what it is capable of. The max battery life with minimun hassle in normal use :)
[Nexus One Android Development] zdiamant:
Ok guys, I got my new 1600mAh battery from ebay -- link: http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=270650209530&ssPageName=STRK:MEWNX:IT

Went into learn, and only charged to 1534mAh :( .. Not as positive as I would have liked. I may go back to my 2400mAh battery that got 2930mAh, if I can stand the extended case.
[Nexus One Android Development] RogerPodacter:
Thanks for that. Loginwithnoname has made some progress to show why my original code wasn't quite right, has to do with defining those new variables as u8, u16 or int etc. However that age scalar is still showing 121, I'm starting to think that IS the correct value. And no name has tried every different way and keeps getting that result.

Let's assume for a sec that's true number. That means all of our age is set at 94.38% and never changes (makes no sense, but just go with it for a sec).

Do the rest of the math, .94 * 1450 = 1368 mAh. Well gee, isn't that the number we ALL see when we get to full charge? Is our age somehow disabled and not counting down like its supposed to and like it does for the pre guys? Is it maybe an added cost to include that and we have a cheaper battery?x

I know that's crazy talk so I'm gonna assume we just aren't defining it correctly in the code.

However why haven't any of us seen our capacity drop over the last month in OS monitor? Technically its supposed to reduce as age scalar increments over time. We don't need code to see that, just look at our value in our stock logs. It never changes...

Edit: I just now saw the actual values (was cutoff on my phone browser) and they definitely are not right. So it seems they must be defined as something else perhaps, maybe u16?
[Nexus One Android Development] dvgrhl:
So what would be the best thing to start working on? Should I modify the code to output the values of the bits in the status register? Is there a different value that is more important to see first?
[Nexus One Android Development] RogerPodacter:
it would be a lot of help having a second pair of eyes working on this. you should perhaps talk with loginnoname first, but i can give you the quick update.

He successfully added the status register to the dmesg log. and he also increased the sample rate of the entire driver itself. that part is somewhat easy (i think?), in the code you will see FAST_POLL and SLOW_POLL, at 60 seconds and 10 minutes, respectively. he increased fast poll to 10 seconds, so that we can monitor the status register in "real time", well moreso then we could at 60 second intervals. (not sure, but our log actually outputs every 50 seconds. at line 562 in the code you see "seconds - 10" which i suspect is where the 50 seconds part comes from). but that's all over my code level (which is not much).

also, it seems that the registers sometimes get different outputs depending on how they are defined, such as u8, u16, int. so if you are more knowledgeable than myself, perhaps you can figure it out?

anyway, some of the ones we need:

Status Register 0x01 (most useful)
Age Scalar 0x14 (most useful)
Age Capacity 0x62/0x63
Full 40 0x6A/0x6B
Active Empty Volt 0x66 (this would be most useful if I had to chose)
Active Empty Curr 0x67 (this would be most useful if i had to chose)

Rated Capacity 0x32 (would be very useful)
Charge Volt 0x64
Min Charge Curr 0x67

you could jsut start out with one or a few. these might be tricky cause they need the conversion equations written into the parse function code. i can help if need with the units for each, but nonamelogin could help much more.

take a stab at any of those above if you feel up to it! thanks.
[Nexus One Android Development] RogerPodacter:
quick update, dvgrhl was nice enough to do a quick compile. some results:

full_40 = 1452 mAh

age_capacity = 1393 mAh

age_scalar = 94.53% -- still same as we keep seeing. WTF?

rated_capacity = 255 -- bogus number. almost seems like this register is just NOT used. in binary, 0-255, 255 is 1111 1111. we just must be missing something on this one...
[Nexus One Android Development] RogerPodacter:
here's something interesting from the data sheet page 17 to consider:

7FFF is two bytes of 1's. so 7F is 127 or 0111 1111 and FF is

255

or 1111 1111. is it possible that rated capacity is somehow reading above its limit, thus reporting a full register? makes no sense to me, its a reach...
[Nexus One Android Development] dvgrhl:
Do you mean outputting a 0 or 1 for each bit of the status register? Because it would seem that doing this would tell you for certain if you are in a learning cycle or not.

I believe u8 and u16 are custom defined types. I need to find in the code where they are defined to be sure, but I suspect u8 is an 8 bit char, and u16 is a 16 bit char.

I'll start looking in at some of these. Every time I read through the DS2784 documentation I feel like a little more makes sense. I want to try to understand more of what is happening in that driver code though, and where in the rest of the code the driver is being called.
[Nexus One Android Development] RogerPodacter:
We made a ton of progress yesterday so I now can define any register if you need. We got things going pretty good, so now its just a matter of picking more of the ones we want and output them. Maybe hit me a pm if you want. But I can tell you for any register exactly what the output will be, such as register 0x66 will always be a 4 digit whole number, always, never a decimal. So int works, unless you want to do something more with it in the code afterwards, like perform a calculation. But how you did the other night with just the raw value is the quickest. Let me know if you need which ones in particular.

The status register, no we just output the raw hex value. That one is fine with that cause we know we're looking for 0x71 for example for learn mode active.

Edit: however I should back up and say that its still confusing with some, for example age scalar always the same number. So we do need your help still figuring out register pulls, I didn't mean to sound like it was all figured out. But we did make some good progress.
[Nexus One Android Development] dvgrhl:
Hah, no that sounds great. As you can obviously tell, I don't have near the time needed to devote to this. You guys are doing just fine without me it looks like. :)

One thing though, I don't think the status register will always necessarily be 0x71 for learn mode active. You only know for sure what the last 4 bits need to be, 0111. The first 4 bits don't have anything to do with the learn mode. So effectively, 0111xxxx is what you need where x = 0 or 1. Unless I have missed something from the documentation? Or unless you know that the first 4 bits are always 0001 regardless?

Age scalar is stumping me. According to the documentation, this value should be variable. But we always see it as the same value. That would suggest that it is hard coded. One thing the documentation seems to say is that if age scalar is set to 50%, that will initiate a learn cycle. Does it read that way to you?

Edit: duh, 121 is 95% of 128, which is 100% age scalar. The documentation suggests setting the age scalar to 95%, which would be 121. I just figured that out, sorry if it was mentioned before or well known.
[Nexus One Android Development] RogerPodacter:
No you're right, there are many combinations it can be. 71 is just one we know for sure. Also we can narrow it down more, we know AEF bit 06 should always be set as well for learn mode to take place. And we know bit 00 is not used yet always set to 1 with no explanation in The docs. So that helps narrow it down, but it can be many different combos as long as bit 4 is set to 1.

Yes 121 actually comes out to 94.53% and I've read that about the 95% thing. Still not sure why its the same for all of us and not changing to boot. I guess the big question is are we doing something wrong perhaps with how we pull these register values? Is there something we don't know or are doing wrong? It's hard to know for sure so that's kinda where we need help I think.

Edit: the way I read the 50% thing is that the manufacturer should code into the OS a message to the user to do a learn cycle. But not necessarily that it will happen as it is unless they coded that part in.

One or two of the pre guys I think had that value for age and didn't mention getting a message.

I could be totally wrong though.
[Nexus One Android Development] dvgrhl:
Well my thought was just to use AND operations and output each bit of the status register. I may still do that just to see.

I have a theory for why the 121 makes sense for the initial 95% value. To me the reason it is staying at 121 is that we haven't yet fallen below 95% capacity in our batteries. 1400 * .95 = 1330. I am still above 1330 mA on my full charges. I suspect we'll see this value decrease as the batteries start loosing more capacity. Time will tell I suppose.

Edit: I just saw your edit. I think the term "user" refers to the coder that writes code to work with the "host". I don't think it's intended to mean a "phone user" in our case.
[Nexus One Android Development] RogerPodacter:
That would be great to have the status register show the bits.

That's a pretty good theory. What's even more interesting is the age algorithm takes full 40 * scalar = our supposed aged capacity. 1452 * 0.9453 = 1370 mAh. And I see 1368 mAh at full charge at 40C. Seems too much of a coincidence to me so it very well could be true. Seems all of us see around 1360 mAh on full charge (it changes based on your temperature reading). So maybe you're correct?
[Nexus One Android Development] RogerPodacter:
Right, in this case I meant it was up to Google to add in this check in the driver code or somewhere in the OS. But we haven't seen that code yet so they prob didn't do it. Who knows for sure though.
[Nexus One Android Development] dvgrhl:
Essentially the code would be something like this:

di->status.status_reg & 0x80 = CGHTF
di->status.status_reg & 0x40 = AEF
di->status.status_reg & 0x20 = SEF
di->status.status_reg & 0x10 = LEARNF
di->status.status_reg & 0x08 = X
di->status.status_reg & 0x04 = UVF
di->status.status_reg & 0x02 = PORF
di->status.status_reg & 0x01 = X

I'll code it into the kernel tomorrow. I'm finally setting up my laptop to compile the kernel so I can do it on the bus to and from work.
[Nexus One Android Development] theloginwithnoname:
I tried doing same functionality, but have forgotten most of my C and ended up trying to do it by converting hex into string and saying "if firstchar == 2 firstbin = 10" etc! :o That is much better.

the reg stuff is fairly straight forward when you've been working with it for a while. If it starts with 1, 3, 5, 7, or 9 it's in learning mode.

Mine learnt overnight and booted from off-charge this morning with 1261. will be interesting to see what another off-charge will do to that figure...
[Nexus One Android Development] theloginwithnoname:
Check the spreadsheet, see where there are gaps (principally where "used? = n") and look to getting those raw values output. Once we're outputting sensibly, look to add in the conversion factors that allow us to output them as a "unit" value. e.g. capacity: raw value X, unit value X * 1600

I'll update the sheet to include what we have so far, and some new columns that Roger can populate with his newly-aquired knowledge of numbers of digits, ranges etc.
[Nexus One Android Development] theloginwithnoname:
Based on the ones we want, Rog, can you post what you know here so I can include it in the sheet?
[Nexus One Android Development] theloginwithnoname:
Let's be a bit (fnar fnar) careful here, as some people refer to the 1st bit as "bit 0" and some as "bit 1" - perhaps 1st bit is more clear?

Anyway the 7th bit is AEF. As I have seen on my last off-charge, it does NOT need to be "set" as such. I caught the log about a second or two before my device shut down and it was still 0x07. On shutdown it may have set it, but I would just rely on the 5th bit (LEARNF) being 1 to know you're in learning.