yashsingh1/xdaforums huggingface dataset:
[Nexus One Android Development] theloginwithnoname:
Build environment progress

Just a quickie to say, had lots of problems with my dev build under Slackware. Persisted with it until I got into an X11 build cul-de-sac!

Completed a bare build of Ubuntu last night and left it bringing the various required packages down, so hopefully will have something that builds CM6 today.
[Nexus One Android Development] theloginwithnoname:
The dream!

Here's how the Pre app is coming along <jealous>:

http://discussion.treocentral.com/homebrew-apps/260947-dr-battery.html
[Nexus One Android Development] TheMorpheus:
Looks very good. Is there a beta version to try?
[Nexus One Android Development] RogerPodacter:
Great on your build environment, I'd love to try out that code I posted above to see if it works.

One problem we might have, the pre app monitors until the flag is set in real time. Our battery driver only updates every 50 seconds. Unless we modify it or make something else, that won't help us as you only have 10 or 20 seconds once its ready to go :-(
[Nexus One Android Development] theloginwithnoname:
I would imagine the register is being constantly updated but the battery log is only written every ~50 seconds. Can you point me in the right direction if you saw the 50 second update interval in the tech specs?
[Nexus One Android Development] dwang:
I'm right in the middle of a calibration with wildmonks latest kernel. I got my phone in learn mode and I'm charging right now in airplane mode.

I don't want to interrupt anything unless I really have to. Will I have problems with learn failure, unless I flash pershoot's latest kernel?
[Nexus One Android Development] RogerPodacter:
I haven't checked his kernel but my guess is that kernel prob hasn't been updated to the latest time out changes...
[Nexus One Android Development] mtw4991:
You shouldn't have any problems if you're in airplane mode. Good luck.

I don't know either, but I use WM latest custom 1190 kernel and haven't had a timeout problem yet. FYI, it took 3hrs, 18mins to charge the last couple of times, so the timeout values might want to be increase to 3.5-4hrs to assure it doesn't affect the learn cycle.

Feature request: Is it possible to keep the charge current higher longer? The current declines over the charge cycle and as it approaches the last 10-15% before full, the mA really decrease a lot thus taking longer to charge. I can get 50% charged in 45 mins, then the remaining 50% takes almost 2 hours? Seems like a good idea to keep current at >500mA until 90% full or something like that to shorten the charge time?????
[Nexus One Android Development] mtw4991:
1/2 You missed the learn flag and just charged normally. I leave pandora running (to keep current draw above -200mV) but close all other apps once I get around 3325mV and then have the charger resting in the charge slot on the phone, ready to be pushed in.

3 Just leave the charge current at <20, no need to set it back to 80.

4 Then run the one app only as long as you are above-200mV when it hits 3201, the learn popup will appear. I run pandora to listen to the music while waiting, the flashlight/torch and others are just to help it get down there a little bit quicker, lol. sry if it wasn't clear, maybe they shoud say "turn on enough apps" to keep current above -200mV
[Nexus One Android Development] RogerPodacter:
unfortunately the charge current is not something we have any control over whatsoever. That's just the way li-ion batteries work. there are 3 stages of charging, the first is fast charging at high current of 1C, then it switches into leveling off at 4.2 volts at whatever current the battery can pull. and as the battery gets fuller and fuller, it can only take in less and less rate of current. so it slows down on its own, nothing we can do about it:(..
[Nexus One Android Development] djn541:
I just want to say that you all are doing fantastic work with this. I've been running trial and error for 2 days now and I think I finally have it down:D One thing I'd like to add though...when you're in your learn cycle, you shouldn't have auto brightness on as it can screw everything up at the end of the cycle. I'm not sure that anyone else uses it, but it can inadvertently draw more at the end of the cycle and potentially mess the whole thing up. Just my 2 cents so far:)
[Nexus One Android Development] RogerPodacter:
Thanks:-). No worries, the next version we are testing has some settings menu items you can turn on or off, screen on is one of those. How exactly did your learn get with that if you don't mind me asking?
[Nexus One Android Development] djn541:
well, I'll be honest. 84% bat age 1204 capacity. But I'm going to have to run it again. I completely forgot that I had a notification set for 5PM daily. That was enough to drop the charge current below 20. I also think you misunderstood me. I was just suggesting that people using this should not have auto brightness on. I kept the screen on the entire time each time, but I noticed that with any changes in room brightness, it would begin to pull more which could scew the learn cycle. Is this assumption correct??? Keep up the good work, and I will test anything new that you have to offer:)
[Nexus One Android Development] mtw4991:
your assumption is correct
[Nexus One Android Development] djn541:
Oh well, not bad for a first successful attempt;) I will however turn that notification off next time and do a "pure" learn cycle. I'm still kicking myself that I forgot....Practice makes perfect right?
[Nexus One Android Development] dvgrhl:
OK, we have a new update. There are a couple of things to note:

We changed the name to Battery Calibrator.

Thanks to j3di's link, we now have a graphic designer (nemuro) helping us so there is a proper app icon. More UI improvements to come.

The option to keep the screen on will dim instead of using full brightness, this should help with any issues when nearing empty.

The latest version can be found here: http://jonrichards.net/xda/battery_calibrator/. Let us know how it goes.
[Nexus One Android Development] temasek:
There is a new item called "Aged Capacity". What's that?
[Nexus One Android Development] dwang:
I'm assuming the latest version is BatteryApp.zip?

EDIT: I guess its the BatteryCalibratorxx.zip file
[Nexus One Android Development] dvgrhl:
No, that was the very first version we ever had up. The latest version is here http://jonrichards.net/xda/battery_calibrator/BatteryCalibrator20101205.zip. I put the date in the file names to help keep track of what order they are in.
[Nexus One Android Development] RogerPodacter:
i added in aged capacity because it is related to age and full40 and all this learn cycle stuff, but i dont exactly understand how. the data sheet tells us about aged capacity. and actually you reminded me that i stock nexus value is 1393mAh but i forgot to uncomment the code, so that is hard coded. **** i'll remove it and get it going proper. i'll leave it to you guys to figure out how exactly aged capacity means anything. it says the higher you set it retards age, and the lower accelerates age.
[Nexus One Android Development] temasek:
Yeah hardcoded cuz mine shows 1393 aged capacity too in my 1600mAh battery.

Will experiment it soon enuff.
[Nexus One Android Development] houzuoguo:
gonna try the new version now :)

thank you so much!
[Nexus One Android Development] RogerPodacter:
yeah i'm adding the code right now to pull the registers for this one.
[Nexus One Android Development] dwang:
Finally got my battery calibrated following mtw4991's instructions with pershoot's kernel.

When I rebooted, my new age is now showing 100%.

Thanks everybody for their hard work!

Dave
[Nexus One Android Development] dvgrhl:
I don't think age should be showing 100% on a successful calibration. You should try again. Your age should adjust down on a successful calibration.
[Nexus One Android Development] mtw4991:
What does the empty current of 200mA do or signify?
[Nexus One Android Development] temasek:
Unless possibly its a brand new battery. Mine shows 100% after calibration. - twice in fact.
[Nexus One Android Development] dvgrhl:
Good point, if you have a new battery that is improperly set up then yes this could be the case.
[Nexus One Android Development] dwang:
are you sure? thats exactly what mtw4991 stated in his instructions.

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

this is my 2nd calibration attempted, my 1st calibration showed 94% for battery age which I thought meant a failed calibration.

my battery is about a year old, so its not new.
[Nexus One Android Development] temasek:
Whats your full capacity vs your full40?
[Nexus One Android Development] houzuoguo:
sorry maybe this is a noob question :)

what does "full40" indicate? does full40 mean battery's capacity when out-of-factory?
[Nexus One Android Development] temasek:
Maximum possible range of your battery in terms of mAh
[Nexus One Android Development] chowlala:
Man. I'm really liking the new Battery Calibrator.

It's truly an excellent piece of work stemmin from the brilliant minds here. =)

Can't wait to see an actual finished app! =D

Keep up the good work guys!
[Nexus One Android Development] mtw4991:
Set your age to 100 BEFORE you begin the learn cycle. after learn is completed AND you reboot THEN you will see your true age. If your age shows 100% after you it is either a brand new battery or a false reading. If it shows 94%, learn failed usually.
[Nexus One Android Development] houzuoguo:
thanks :)

yesterday I did a calibration but didn't success, i accidentally turned screen on while battery still had 10% to be charged..

this time i'll leave it there overnight
[Nexus One Android Development] dwang:
My full capacity shows 1433 at 100% charge. Full40 is 1452, so looks like my battery is pretty close to 100% even though its almost a year old (bought my n1 at launch day).
[Nexus One Android Development] RogerPodacter:
that's the min current you need to pull to activate the learn flag. its AEcurrent.
[Nexus One Android Development] RogerPodacter:
so you're talking about your new 1600 battery that you got 100% on both your learn cycles? i'm so psyched to get my battery i ordered. my personal opinion is these stock batteries are seriously under powered / under rated. has anyone here seen a single person get over 1200 mAh on a learn cycle? i havent. and these are rated at 1452. if your 1600 battery is in fact giving you 1600 of usable capacity, then that is an ENORMOUS increase over stock, and it fits with the stock cover! AND its only 20 bucks, 10 if you order from ebay! i mean its a no brainer. and it should give the nexus one the proper battery life it should have been getting from the beginning..
[Nexus One Android Development] RogerPodacter:
the full40 can be thought of as the "manufacturer's rating" of our battery, its the maximum full capacity that out batteries are supposed to be. its the capa at 40C temperature since that gives the most performance out of a battery.
[Nexus One Android Development] temasek:
I am at 80% now after few hours of use. Going to test till it die to see if I can really use the full indicated capacity of 2452mAh. Will report further.

I am psyched!
[Nexus One Android Development] j3di:
Damn, keep forgetting to check the Status Register at the end of a learn cycle!

Had 2 Learn Cycles now, not sure if they were successful though.

1st Batt Age was 84%

2nd Batt Age is now 90% (Full40=1452), this was after changing aEvolts to 3201mV and minimum charging current to 20mA.

By reducing aEvolts from 3.41 to 3.20 this is effectively also increasing the run time of our battery?

I'm also using WM's latest kernels. This is the Battery Commit he links to : https://github.com/CyanogenMod/cm-kernel/commit/0966b128c2a5c4a93860e9df4a9a0c416fa0ac5f

Edit: Anyone got a link for where to purchase a decent battery that fits the stock case?
[Nexus One Android Development] temasek:
http://www.htcrepairparts.com/standard-battery-for-htc-desire1600mah-p-3007.html

Or

http://cgi.ebay.com.sg/ws/eBayISAPI.dll?ViewItem&item=220674648122&ssPageName=STRK:MEWNX:IT
[Nexus One Android Development] j3di:
Many Thanks!
[Nexus One Android Development] temasek:
Updated report - new 1600mAh battery

Full40 2500mAh

Capacity 2452mAh / battery 100%

Now at 41% battery level, still alive with voltage at close to 3800mV. I strongly believe I can use my full capacity of 2452mAh.

Will report later. Its great so far like having an actual 2500mAh battery.

Edit: now at 29% with 721mAh left at 3735mV voltage. Seems good. :)

Edit: now at 24% with 585mAh left still at voltage 3737mV. Strong voltage!!!

Edit: now at 17% with 409mAh left at 3698mV voltage. I'm not surprised now..... :)

Edit: now at 10%. My led start to blink red. Good sign. 252mAh left with 3664mV voltage.

Edit: now at 5% with 139mAh at 3630mV voltage.

Edit: now at 2% with 64mAh at 3520mV.

Edit: now at 1% with 35mAh at 3405mV

Success! Full capacity 2452mAh drained by empty voltage of 3201mV
[Nexus One Android Development] samarium:
IIRC, It seems the kernel can elect to let the battery to discharge to x% before starting charging, ie 95 or 90, so if it can do that I don't see why we can't harness the same logic to basically automate the learn process.

echo n > charging # 0 = off; 1 = on; 2 = learn?
[Nexus One Android Development] mtw4991:
Ok thought so. It will show the current being pulled as we move to learn cycle dynamically right? Or just for reference?

My learn cycle always shows around 1254mAh after learn.
[Nexus One Android Development] mkrmec:
Question about the battery app...

What are the fields X in the Registers tab?

ACR

Active Empty Volt

Full40

Age

I take it the Full40 and Age are the same as on LearnPrep tab?

But what about other two?

Active Empty Volt = aEvolts?

ACR ?

And do they actualy work.

Thank you
[Nexus One Android Development] theloginwithnoname:
it can, although it's more when a battery probe happens that the kernel code can say "if % < 100, full = 0" and so it starts charging.

Sort of. They are already defined as CONSTants somewhere - for example, when battery reports full, the charge_mode is set to something like BATTERY_CHARGE_DISABLE.

I'm going to try and have a look at this tomorrow. It's likely I might be able to set the code to change the "re-chargeOn%" value too; i.e. default to battery built-in 90% but allow "echo 98 > rechargeAtPercent" for example.
[Nexus One Android Development] chowlala:
Alright.

Successfully landed on LEARN mode with mtw's method.

In airplane mode now, gonna see if I fully calibrate by the morning. :)

Funny though, I missed the first drop to 3201 volts. And the phone then shut down.

Plugged in for a minute, turned on phone, faked the mAh, and this time I was ready, with the charger halfway in already. Lol. The second the beep went off I was in. Funny I tell you.
[Nexus One Android Development] mtw4991:
Mine doesn't beep, she moans or sighs. :D

Chow, did you have the wake lock and ACR Adjustment checked in Settings? Did it work, i.e. did the screen stay on and did the mAh capacity stay above 20mAh? Getting ready to do another learn mode and really curious if they are working as intended.

IDEA: Can we code something into the program that will keep current above -200mA so that we don't have to run external apps to hit learn mode? Running those apps is the only real pita left to overcome it seems.
[Nexus One Android Development] RogerPodacter:
nice. the new version of the app has the ACR fake thing built in for that exact scenario. say you miss the first learn attempt, charge for a min, try again and it will bump up the mAh for you automatically. that setting must be turned on of course!
[Nexus One Android Development] RogerPodacter:
yes the idea is we are extending battery life by lowering the empty volt. by how much though is debated since it drops so fast down that low.
[Nexus One Android Development] RogerPodacter:
damn now i'm kinda regretting not getting the ebay one that you got. so this new battery fits in the stock back cover, and is giving you all that mAh capacity? incredible, how long did it take to drain all that? i'm kinda baffled about this but i cant wait now to get my battery!
[Nexus One Android Development] chowlala:
Heh. That's some wicked sick battery!

Time to get one too. ROFL. Where's the link!
[Nexus One Android Development] mtw4991:
Roger, so if we have the ACR adjustment checked then it will automagically bump up the mAh(capacity), even on the 1st try, so we don't need to go into setreg and 0x10 03 at all right?
[Nexus One Android Development] temasek:
10 hrs plus with moderate/heavy use. I believe is due to new battery as know about 1 week later I should hit better scores.
[Nexus One Android Development] chowlala:
Eh? I hit 12 hours average with moderate usage on my current battery.

And I just saw, my battery seems to be suddenly having more voltage now vs mAh. A couple of times the phone neared below 20 mAh with like 3600 volts left. =(

Hence, why I'm recalibrating again.
[Nexus One Android Development] mtw4991:
or you could just raise your age to use the extra mV without recalibrating and see if you get to 20mAh & 3201 closer to each other...i.e., raise age from 86>87%, charge a little let it drain, etc. kinda a quick hack(did I say that lol) to estimate age
[Nexus One Android Development] temasek:
This is my 1st full discharge. I remembered my initial 1st week usage of n1. Not exactly fantastic either. Need time to warm up. :)
[Nexus One Android Development] mtw4991:
temasek, still have the ebay link? thx
[Nexus One Android Development] chowlala:
Push it to 5000 mAh!! XD
[Nexus One Android Development] temasek:
http://cgi.ebay.com.sg/ws/eBayISAPI.dll?ViewItem&item=220674648122&ssPageName=STRK:MEWNX:IT
[Nexus One Android Development] temasek:
Full capacity 2472 and still charging ..... omg maybe gonna hit my full40 of 2500mAh.

Or maybe it hasn't reach its potential yet. Lmao. :)

Edit: doh said too early, it stop charging and capacity drop to 2454mAh now. - 100% fully charged.
[Nexus One Android Development] chowlala:
Haha. Try resetting the full40 to 3000. :P

BTW, I just noticed you're from Singapore. =P I'm in Malaysia. =P
[Nexus One Android Development] temasek:
I might try it cuz.....

1st full40 set at 1600

Capacity hit 2400++ at 99% before settling at 1542 or is it 1572 (poor memory)

So comes 2nd full40 set at 2500.

Capacity nearly matched 2500 before settling at lower number.

Will try 3000 ....haha. :)

Ah ha! Nice we are neighbors!!!!
[Nexus One Android Development] chowlala:
Haha. Here, at XDA, we push the limits! GOGOGO!

We should have an Android meet up in Singapore. Can call Wysie too. ROFL.
[Nexus One Android Development] RogerPodacter:
yeah you basically shouldnt have to worry about it at all. we set it up so that if you are doing your first attempt, draining from 100% to empty, the learn should kick in normally and you probably wont need to bump up the mAh. but if you miss the first try, charge for a few min, and try a second time, it should bump up your mAh.

technically even on your first attempt if you are running out of mAh it will kick in too. the conditions we used are:

if (capacity <= 70mAh && realtimevolt - emptyvolt <= 0.2volt)

bump up the ACR

its very much a beta still, so please look for any issues with the above if you notice anything. i tested it a few times and it seems to be working. i tested a first attempt and a second attempt, and also simulated it by setting to 100mAh at 3.5 volt and drained, and the condition worked ok. but just keep a look out for us cause that one is a little hairy..:).
[Nexus One Android Development] mtw4991:
I should know shortly, lol, as I'm down to 12% right now. Does learn need to be turned on for it to work?

Yesterday I deliberately failed learn to charge to 100% and set age to what learn said the day before to see if it would still make it down to 1%. So far so good.
[Nexus One Android Development] RogerPodacter:
this is something i've been wondering about while we all do our learn cycles. i have to wonder is the mAh vs volt a truly linear relationship? i dont think it is. lets say i have age=100 and do a full drain, but i dont push the phone hard at all and just let the battery drain over a few days.

next say i charge to full and drain the phone as hard as i can with everything at max, killing it in 7 hours.

will both situations use the same amount of mAh for the given voltage range? i think the lighter you use the phone, the more mAh you can use before depleting the voltage. but the heavier you use the phone, the voltage gets pulled down hard enough to not use all the mAh. if true that kinda means its like a moving target, but i dont know if its true or not...just something i've thought about.

of course i understand that technically the mAh should match the voltage no matter what conditions used, since the mAh reading is coming from the ACR which is coming from the sense resistor that counts all current coming to/from the battery. so it should match up since its counting actual juice flowing thru the battery...
[Nexus One Android Development] RogerPodacter:
yeah for real. dvgrhl took his voltage down to 2.5 the other day. i wanna see someone do a learn cycle with that empty volt and see how much difference it makes! with a new battery on the way maybe i can just trash my old battery with some extreme testing....but i'd be too worried i'd damage the phone at the same time:(.
[Nexus One Android Development] mtw4991:
so effectively, if the ACR adjustment works as planned and we set the empty point, full40 and age then we turn on learn mode, the only thing we have to make sure of is keeping current above 200mA and we are good to go! Too bad we can't automatically set current above -200mA, then the app would be self-fulfilling!
[Nexus One Android Development] chowlala:
FUUUUUUUUUUUUUUU. :mad:

I turned on my phone at 85% and the current dipped to -1 wtf, and that canceled out LEARN. Sunuva.

EDIT:

Only good thing is that it already hit the "max" capacity, 86% then after the LEARN got canceled, immediately showed a jump to 100%.

Which is about right. Because that's my battery age from the last manual learn cycles.
[Nexus One Android Development] RogerPodacter:
Yeah basically that's it. Over the weekend we actually had a third option called gps polling to drain faster, but we took it out I think cause it wasn't adding enough draw. Maybe we'll add it back in if it keeps current high enough. Dvgrhl would remember better on that one...
[Nexus One Android Development] mtw4991:
JEEZUS CHRIST!!!! that was nerve wracking, fml:eek: I got down to 20mAh!!! and 3405mV before the damn ACR kicked in...one more update and I would have been toast @ autoshutdown...WHEW!!!!!!!!:p

Hey Roger, can you set that damn timer to like .25 or .3 or something? 3.201+.2 is cutting it real close before the app asked for SU and added 200mAh and kept me in sef mode!
[Nexus One Android Development] dvgrhl:
I spent a good amount of time this weekend trying this by using the GPS and polling continuously. It did drain fairly good, but I didn't get it stable enough for release. I'll revisit it some time, but I wanted to focus on some other features that were really critical first. The idea was to have GPS keep polling until the battery gets close to empty, and then turn off GPS automatically. I also plan to add an option to automatically switch the phone to airplane mode when learn mode is detected. Both of these would be optional settings.
[Nexus One Android Development] mtw4991:
That's cool and would be good...maybe GPS and Wifi Hotspot? I always use Hotspot and Flashlight, but don't want to use flashlight anymore as I don't want to over-use the led.

Also, while you're coding stuff, PLEASE consider my request in the post just prior to yours....heart is still racing!:D
[Nexus One Android Development] dvgrhl:
I originally had it at 0.3 and moved it down to 0.2 for everyone to test with. I can set it back to 0.3 if it is cutting it too close. I know from my tests that 0.1 was too late. Ideally we want it as low as is practical, so we aren't doing the ACR write unless it really is needed. 0.3 might be a good compromise though.