yashsingh1/xdaforums huggingface dataset:
[Nexus One Android Development] RogerPodacter:
Awesome, glad its working for you guys. Just fyi, once you activate learn mode you can probably turn off the detect button just so it doesn't keep polling the status register like crazy in case that could cause it to fail. Another change in the code we prob should make.

Also what do you guys think of the UI and layout etc? Should we change anything etc? In the future we'd like to add graphing, tracking mAh depletion rate and other rates, set alarms for different levels, etc. Tons of possibilities, but that's way down the road.
[Nexus One Android Development] mtw4991:
Roger, what is the setreg code for 1452 stock full40 value? So, the inference that I'm getting from your statement says that to do a "proper" learn cycle, we should always have age = 100 and full40 = 1452, then set age by dividing the full capacity at 100% by the stock 1452, ex. 1280\1452=88.15% age. Correct?
[Nexus One Android Development] mtw4991:
One thing I have noticed on several occassions is if I leave the app by pressing home, not backing out, and come back into it, "sometimes" the learnf waiting message is gone but the learn mode on button is still lit. Have to turn off/turn on to get the waiting for learn state to re-engage. np, just a quirk.

Also, what is the "spare" item for...a spare battery? fyi, I did get the sound notification when the learn popup appeared...not that I needed it as my eyes were glued to the dang thing:D
[Nexus One Android Development] RogerPodacter:
stock 1452 command is:

0x6a 0d

0x6b 9d

do both of them in order.

well to do a "proper" learn cycle you leave your full40 value set to the stock value of 1452, and setting age to 100 helps ensure that the voltage will be hit before the mAh runs out. but you really dont have to do any of the division because if you do the proper learn cycle using the battery learn flag, it will calculate the correct age value for you and set it accordingly. but yes to manually calibrate i think the equation noname came up with was jump point/full40 = age.
[Nexus One Android Development] RogerPodacter:
i havent tested to sound yet, i'm curious what tone it used.

the spare is for nothing really, i just didnt have anything else to put there. i am thinking about adding in full charge volt into that spare slot, which is 4.099volt right now for our stock battery. or i could add AEcurrent there. but either of those are not really necessary and i dont know if they confuse users with no value added, or if its good just to see for the hell of it? could also add avg current there as i dont think we've put that in yet.

i feel like we could spice up the UI but i dont know which way to go. maybe some icons like a battery image or something, etc. change the layout? ahh i'll prob just leave things as-is, its good enough for now i'd say.

oh also i changed the pop up last night so it has a title and an OK button to press so you dont have to hit the back button.
[Nexus One Android Development] mtw4991:
The tone was low as I had sound turned down, but I think it was just a beep? I didn't notice the popup or what it said, I just slammed the charger and backed out, lol. I actually like the layout, but maybe I'm used to it by now. You could put a small battery icon where the spare is, but you would have to code it to say "full" when charging stops which would be different for everyone right?

The best thing, imho, would be to get the "regular" user input functional in the LearnPrep tab...btw, what is "ACR"?

Also, does WM's kernel have the code to charge an extra hour or so like Pershoot reccommends for his kernels with your battery code in it...iow, should we charge an extra hour still or not necessary?
[Nexus One Android Development] RogerPodacter:
that charge for extra hour comment is old and no longer applies. it was when the if statement added <40mA so there was a delay from when the CHGTF flag turned on, indicating to the OS that the batteyr was full, to when the <40mA condition was satisfied. now all that is fixed as we can set the register to whatever we want. hence that extra hour is not necessary as you can see once CHGTF is on nothing else happens to the battery, its completely full at that point.

ACR is register 0x10 which is the accumulated current register which is what tracks the mAh going into and out of the battery.
[Nexus One Android Development] mtw4991:
Ok, charge has completed but I'm not sure if learn was achieved??? The learnf light was on for most of the charge but it still jumped from 80% to 100% at 1244mAh and 4187mV with full40 set to 1558 and age 100.

So, 1244\1558 = 80%, which is the full40 jump point which is my new age, right.

Alternately, I could set full40 at 1162 which is 80% of 1452, right?
[Nexus One Android Development] RogerPodacter:
try a reboot, that should show your new age being set.
[Nexus One Android Development] RogerPodacter:
yeah i kinda like the layout too i guess. i experimented with a few different backgrounds and gradients/colors. not sure why i settled on the final one. but i really didnt know exactly what i was doing so i didnt know if its acceptable or not.

we'll get the second tab working soon and then from there think about adding any missing features that might be worthwhile...
[Nexus One Android Development] mtw4991:
rebooted, but age is still set to 100% in the app???

Edit1: set age to 80%, rebooted, nothing changed, full40 still 1558 & capacity still 1547mAh.

Edit2: set age to 80% & full40 to 1452, rebooted and capacity STILL shows 1547mAh.

Summary, guess I didn't achieve a full learn cycle, but a super bump charge, lol. Capacity should be 1162mAh defined by 80% of 1452 or alternately 1246 defined by 80% of 1558. Equivalently the same?
[Nexus One Android Development] RogerPodacter:
hmmm that's weird. the learn flag stayed on the entire time till full charge? if so then something just isnt working right as that's all you need to do. no idea man. you did it right. however didnt you say you changed your age value in the middle of the learn cycle? if so that's the only thing i can think of, maybe that threw something off.
[Nexus One Android Development] mtw4991:
Yes, I change the age at around 35% (0x31), but I did say that the learnf light went off around 65-75% full, then at 80% it jumped to 100% @ 1244mAh. I have it set currently to 80% & 1452 to drain it down and next time I'll do 100%/1452. Too bad we can't do learn mode with the phone off, so nothing interferes with it. I had airplane mode on and sound off the entire time. idk...
[Nexus One Android Development] RogerPodacter:
oh i missed that. the learn flag must stay on the entire time. so for some reason your learn failed around 65%. maybe a timeout occured?

similarly i tried a learn over the weekend, with the new 3 hour timeout poll, and mine failed right around 75% as well. no idea why, it was on one minute, the next minute it was just off. i never investigated it as i was on vacation, but maybe its related. although we know one person here has done a full learn with the app and his age actually updated, so its definitely gotta be working somehow.
[Nexus One Android Development] mtw4991:
no clue here either, but then again I had to read both threads 10x just to get a clue;). Gonna try 100/1452 next time and see.
[Nexus One Android Development] chowlala:
Try setting age at 94.
[Nexus One Android Development] theloginwithnoname:
+1 - tell me though, Rog, if you can't sleep, do you count sheep in 2-byte binary hex via status register?!! :D
[Nexus One Android Development] chapelhill:
I have managed a full learn using the app. I tried loads of times until I relaised current drain needs to be over 200mA as well. After learn battery age got set to 85% with full40 left as 1452. Left phone for over 3 hours to charge. Currently at 58% with 705mA and 3.815 volts. Will try and drain tonight to see what shuts it down.

Many thanks for all the effort on this one, I think it makes a real difference to the usability of the phone and that will be doubly so if the extended batteries work.

Regards

Chapelhill
[Nexus One Android Development] BakaPhoenix:
i can't reach the learn flag because the nexus shut down before... Can someone give me some advice plz?
[Nexus One Android Development] temasek:
I set my age to 100 and charge it full and settings my empty voltage to 3201mV. Once fully charged your mAh should be sufficient to last till your voltage hit near your empty voltage value.

Important is your mAh must not die before your voltage.
[Nexus One Android Development] BakaPhoenix:
sorry for the very noob question... How can i set the battery age? reading some page of this topic i found out that i need to write something on the terminal emulator, but i don't really understand what <.<
[Nexus One Android Development] temasek:
Open setreg in text editor and key in 0x14 80
[Nexus One Android Development] mtw4991:
funny thing happen yesterday attempting learn...was using 80%/1558 and it charged to 1547, then I said what the heck, changed it back to 80% and 1452, but mAh's stayed at 1547 and I got over 3 hours of moderately heavy use out of it before it dropped to 99%. Now at 17.5 hours and still have 41% left with mod use. Nice super bump charge in only 3 hours! Not a bad way to fail at all:p
[Nexus One Android Development] temasek:
Let me guess.

Your battery will shut down in the 20% +/- soon .............
[Nexus One Android Development] BakaPhoenix:
Thx a lot!!! let's hope that the next time the battery will not dies before the learn flag
[Nexus One Android Development] temasek:
If u set to age 100, charge to full.
[Nexus One Android Development] mtw4991:
It might, right now it's at 3605mV and 376mAh and 32% remaining...seems kinda on track to me but I'm still trying to get my head around this stuff well enough, lol. Just trying to run it down and do a 100%/1452 learnf all the way to full.
[Nexus One Android Development] mtw4991:
ok, just hit learn again and yes, Temasek, shutdown around 20%...smartypants:D

doing learn this time at 100/1452/3201....hope it completes the full learn cycle! Any suggestions to complete the full learn or is it just hit or miss?
[Nexus One Android Development] mtw4991:
Damn this is tedious watching it drop to <20mA...currently at 47mA and 0x11 !!! Looks like I'm gonna complete the cycle this time...someone will probably call me and drop it below <20 but I hope not!:eek:
[Nexus One Android Development] temasek:
Its not a guess actually. ;)

Why are your values same as mine? 100/1452/3201 ? Lucky you never try min at 20mA..........(a hint)........
[Nexus One Android Development] mtw4991:
Yeah, I know....btw, at 28mA and 4181mV...looks like learn is going to complete!

Edit: I am using <20mA btw. Yes, the same

EDIT: Fu@k, got a damn phone call at 27mA left on charge and it jumped from 1240mAh @ 86% to 1440 and 100%!!!!!!!!!!!!!!!!!!! Guess my age is actually 86% huh?
[Nexus One Android Development] temasek:
I think its normal cuz your real actual capacity now is about 1250+/-. Possibly yes age 86%. Mine is 85%.

Once confimed full charge then start draining.

Good luck.
[Nexus One Android Development] mtw4991:
Temasek, what is the code for 86%? 0x14 ??
[Nexus One Android Development] temasek:
I'm not good at conversions. Age 84 is 6c. Try to up abit and see.
[Nexus One Android Development] mtw4991:
6f = 86%, thanks for the help!
[Nexus One Android Development] mtw4991:
Last question, now that I know my age, should I leave full40 set to 1452 and age 86 or should I change full40 to 1248 and age to 100? Seems like the same thing and won't matter???
[Nexus One Android Development] temasek:
Its the same but I go for age 86% and full40 1452.
[Nexus One Android Development] mtw4991:
Me too that's what I settled on also. Thanks for your help buddy!
[Nexus One Android Development] pwig:
Does the second tab work yet? I tried entering in numbers for the age and full40 but they didn't stick.

I have yet to hit learn mode and would like to manually try some things. Do I still have to change the values using terminal/root explorer?
[Nexus One Android Development] temasek:
The 2nd tab not done yet. U have to manually insert the values of the registers for now.
[Nexus One Android Development] mtw4991:
No second tab doesn't work yet. Use terminal or root explorer. Also to hit learn you must be discharging current at greater than 200mV as mV hits 3416 and have enough juice (mAh's) so the phone doesn't die prior to hitting 3416mV. I turned on pandora as I got close so it could run in the background while I watched the app. Worked like a charm!
[Nexus One Android Development] k3vink3vin:
Remember to keep the current at -200mA or more in order to obtain the learn flag.

I completed a learn cycle for my first time yesterday. I Had to have Navigation running in background with GPS turned on in order to maintain the -200mA current.

Turns out my battery only holds 1550mAH x 81% = 1255mAH
[Nexus One Android Development] BaGRoS:
I use this kernel for HTC Desire http://xdaforums.com/showthread.php?t=782875 with Battery Calibration App is working (install this app http://xdaforums.com/showpost.php?p=9407901&postcount=157. BUT... I can not discharge the battery to the required level of 3416mV :( . Phone always turns off the power at ~3659mV / ~<1% batt...
[Nexus One Android Development] samarium:
See my method http://xdaforums.com/showpost.php?p=9516181&postcount=1134 which you could emulate using the battery app.

And my cheat sheet http://xdaforums.com/showpost.php?p=9521062&postcount=1144
[Nexus One Android Development] mtw4991:
Just hit learn again and doing another learn cycle today, but I have a question..

Yesterday, I got a phone call just before learn completed on its' own and artifically shut me down at 27mA instead of <20mA and I want to prevent that from happening again.

Now that I'm in learn mode, can I turn the phone OFF to prevent any disturbances as I approach full or do I need to leave the phone ON so it learns on its's own???

Reason tells me to leave it on, but I'm not sure. :confused: 100/1452/<20mA/3201 fyi
[Nexus One Android Development] dvgrhl:
There is a new version of the app here: http://jonrichards.net/xda/BatteryApp20101202.zip. We have started numbering the versions of the app as we make improvements, so this is version 0.8.1 Beta.

New in this version:

On Learn Prep tab there is a button to set battery age to 100%. This requires super user access, so you will be prompted the first try. (Note, set full 40 is still not functional on this tab right now, but will be shortly. We need to take a little more care in setting this value since it will be based on user input (i.e. probably a range of 1200-3500mAh)).

There is now an About page and Technical info window.

The app shouldn't crash if it's run on an unsupported kernel now, it should just not display any values.

Various bug fixes.

Let us know if you have any problems running the app or using the set age function on the Learn Prep tab.
[Nexus One Android Development] mtw4991:
Nice progress....wish I had of known this 15 minutes ago, lol. In learn mode now.
[Nexus One Android Development] temasek:
The app keeps getting better and better. Really nice work! 3 thumbs up .............
[Nexus One Android Development] mtw4991:
3 thumbs up huh?...must be left, right and benchmark penis!:eek:
[Nexus One Android Development] RogerPodacter:
Thanks:-). For future versions (way down the road) do you guys have any ideas or requests for types of stats we might want to see? Like I always kinda wanted to be able to see for example how fast my mAh depleted doing a certain task or over a certain period of time. Or maybe current vs voltage stats or some thing. Are there any good ones that stand out to you guys? Some cool info could be pulled if we really got creative since we have full access to the battery...
[Nexus One Android Development] j3di:
Brilliant update, the current monitor could enable me to hit Learn Flag this time!

Edit!! Woo Hoo, hit learn mode this time!
[Nexus One Android Development] j3di:
I've noticed it's not helpful to have the screen rotate on while you're trying to calibrate the battery, causes the display to shut off momentarily. Might be useful if the app could do this for you?

PS. Anyone got any tips for maintaining a steady current draw above 200mA? I've turned off sync because that screws me up when i'm close to 3.41mV and a twitter updates or something! Even with wifi & BT on it sometimes drops to 114mA...

Edit: I've just set screen timeout to 30min so that should help a little...
[Nexus One Android Development] pwig:
Yeah I would agree that the screen needs to be reformatted so that the dumpreg page can be read in portrait mode. Also, the learn mode page doesn't need to have such a large red voltage number. Being able to hit the detect button while watching the voltage might be useful. That stuff is minor.

But really what would be cool is being able to hit a button and activate learn mode when the battery gets below something like 20% automatically and only if it is plugged in. So you could let the phone sit on the charger and go to bed. You would obviously need to be able to control when the phone starts charging. Is that even possible?
[Nexus One Android Development] mtw4991:
yeah, set timeout to 30 mins. I turn on pandora in the background to keep above -200mA and works well.
[Nexus One Android Development] mtw4991:
I think I completed the learn cycle. Here is what happened.

4182 20.50 1248 86% 0x11

4182 19.43 1248 87% 0x11

4182 20.16 1249 87% 0x11

4182 19.86 1246 87% 0x11

4182 .0268 1246 100% 0x81 (2nd consecutive reading below <20mA)

unplugged charger

reboot

battery age reset to 86%

percentage is set to 100%

capacity is set to 1243

full40 point is set to 1452

Seems like the 2nd consecutive reading below <20mA is what triggers the 0x81 full flag and learn is completed.

This is correct?
[Nexus One Android Development] j3di:
Ideas?

How about being able to recall the Batt % when the phone was last shutdown by an empty battery? If the Batt % was above a certain value the app could inform you to carry out a learn cycle?
[Nexus One Android Development] xtcislove:
Dont understand what to do with this app ..... my battery dont drain to 3416 MV!? :D
[Nexus One Android Development] samarium:
On shutdown is currently hard, because I haven't figured out how to get a script run on shutdown. On startup is easy & working.

I am testing some scripting to save the current age on the user area on the battery, along with a signature, some other data & a checksum, and then restoring it on reboot, else if it doesn't checksum ok, then set age=100%.
[Nexus One Android Development] samarium:
I think if you read the datasheet, it is when the average current register is below the set point.
[Nexus One Android Development] samarium:
Manual control of charge is something I've been mulling, however haven't poked around the source code enough yet to userstand if it is something the battery does, or something the kernel can ask the battery to do.
[Nexus One Android Development] cowai:
Me too. A simple guide for us that have just arrived in this thread would be very helpful. I am using Desire. Is there anyone who has successfully gotten Desire in learn mode? What settings am I supposed to use?
[Nexus One Android Development] temasek:
I expected yours so its 3 thumbs. Haha: )
[Nexus One Android Development] mtw4991:
It was. The 1st current reading was 19.86mA and the second one had to be <20mA also to create an average reading between the two of <20mA and thus 0x81 was set which tripped the current charge to .0268, thus ending learn and resetting age. I am understanding this correctly, right?

Also, that explains why it didn't end when the reading was (19.80mA+20.16mA)\2=19.98mA and it still retained learn at 0x11.
[Nexus One Android Development] mtw4991:
Also, I can confirm the rapid drop from 100% to around 90%. It dropped quickly to 90% then leveled off once it hit 89%. This may be related to the charging code setting 89% as the set point to allow recharging to begin, idk.

I do have a request for the app also. Would it be possible to reset age, etc once the learn cycle is completed without having to reboot? I was at 87% when learn completed, but upon reboot age was set to 86% due to drain (I guess) from rebooting. Not a big deal, but 1% is 1% and we're trying to get all we can out of these suckers!

Also, I'm using 3201mV...is there any benefit to going down to 3084mV? It seemed that the consensus was the drop from 3201 to 3084 was so fast that there was no real benefit to it?
[Nexus One Android Development] mtw4991:
VERY nice job with the new ui on the app guys..getting close to incredible!
[Nexus One Android Development] dvgrhl:
Thanks everyone for the feedback. Here is sort of the short time goals for the app that we hope to have enabled in the near future:

1. Set full 40 text field to a user inputted range between 1200-3500mAh.

2. Auto-brightness on learn detect so there is no screen dimming.

3. GPS polling on learn detect t help drain battery - discontinued when voltage hits 3.4.

4. Look into echo 0x10 04 if mAh is going to run out before voltage.

5. Get the app onto the market so that users can install updates that way rather than manually download new apk's.

We'll also be looking into the other suggestions given in this thread. Roger and I are new at this, so there's a bit of a learning curve with everything we do. We do need to write up some clear instructions too, so we'll try to get that done in the near future.

Thanks for all of the feedback and excitement, it certainly helps me stay motivated.
[Nexus One Android Development] triciopa:
I will make a monument to you guys on my backyard lol thanks!!!
[Nexus One Android Development] theloginwithnoname:
It is possible to manipulate charging - if I get a few spare hours, I might have a go at turning charge on and off.
[Nexus One Android Development] mtw4991:
Ok, went down to 1%/9mAh @3312mV before it died. Bumped up into another learn mode and powered OFF while in learn mode. Gonna charge to full while off and see if learn is retained. If so, it would be great to be included in the app, i.e. hit learn, power off, go to bed, wake up to accurate calibration.:p
[Nexus One Android Development] triciopa:
Hmmm I hit learn mode while I still had %25
[Nexus One Android Development] mtw4991:
That's because your mV dropped below 3416 (or 3201 if you're set to it) before you ran out of mAh(juice).
[Nexus One Android Development] BakaPhoenix:
I hit the learn flag when my battery was at 13%...

I have to redone the learning cicle lowering the empy voltage?
[Nexus One Android Development] mtw4991:
set age to 100, aEvolt to 3201, current to <20mV, maintain more than -200mV draw, hit learn flag, on-charge, when near the top switch to airplane mode. Works for me every time.
[Nexus One Android Development] BakaPhoenix:
Sorry, can you give me the register code for set the AEvolt to 3201? Thx
[Nexus One Android Development] mtw4991:
My test was a bust! Powered off after learn mode was set, charged for 3.5 hours, powered on and age was 94%!!!!!!! Unless you guys can figure a way to work this out, learn mode while off is #fail :(
[Nexus One Android Development] theloginwithnoname:
good research man!
[Nexus One Android Development] mtw4991:
yeah, was hoping it would work:(
[Nexus One Android Development] pukemon:
just got my mugen 3200 mah battery. here are my initial values.

voltage 3864

battery age 100

full40 3560

chg current 80ma

empty volt 3.006

capacity mah 1531

battery came at 43% charged and i just put in on wall charger. let's see what happens.