yashsingh1/xdaforums huggingface dataset:
[OnePlus 3 ROMs, Kernels, Recoveries, & Other Devel] bedalus:
I've re-uploaded the BLX test version, after moving the hook to a function that gets called every time USB connected. The reason this might have been necessary was to ensure that the limit is actually set when plugged in to charge. I wasn't convinced it was getting called after changing the limit.

More testing is required. If anyone is using this mod in the last test version, please let me know your results. If anyone else wants to help test. grab a copy of the new version.

It's a bit of a time consuming testing phase for this sort of mod because you have to run the battery down, then wait for it to charge up again before testing how it runs down! The more people on it, the quicker we'll have some solid results.
[OnePlus 3 ROMs, Kernels, Recoveries, & Other Devel] Antsu:
I have your first version installed. The level is set on 10. I charged the phone from 40% to 100%. Is it supposed to be that way or was it supposed to stop charging at 80%? Was that the situation you were referring to?

Anyway, let's flash the next BLX version and test again, after battery has ran out enough.
[OnePlus 3 ROMs, Kernels, Recoveries, & Other Devel] bedalus:
You'll need to set the level every time you reboot, as it will default back to 0.

After charging to full, it will probably show 100% charge, but with a little use, you should see it drop to around 80% then level off (drain at the usual rate).

I think this is just something to do with how the fuel-gauge code works.
[OnePlus 3 ROMs, Kernels, Recoveries, & Other Devel] Antsu:
I use Exkm to set the level. I'd forget to set it after boot otherwise :)
[OnePlus 3 ROMs, Kernels, Recoveries, & Other Devel] fcisco13:
Installed new version and set to 5, will charge n test.
[OnePlus 3 ROMs, Kernels, Recoveries, & Other Devel] fcisco13:
Drop to 96% in about 10 minutes.
[OnePlus 3 ROMs, Kernels, Recoveries, & Other Devel] bedalus:
Would you say that's a faster drop than you'd normally see? Did the drain level off to a normal rate at around 90%?
[OnePlus 3 ROMs, Kernels, Recoveries, & Other Devel] fcisco13:
Definitely faster drop, it leveled off at around 87ish

This is with a bit more than 24 hr use with 3hr sot, that first drop is what I'm talking about, so far it's still a great kernel.
[OnePlus 3 ROMs, Kernels, Recoveries, & Other Devel] bedalus:
Thanks very much for the help testing. I'm going to do some more rigorous testing as soon as i get some free time.
[OnePlus 3 ROMs, Kernels, Recoveries, & Other Devel] bedalus:
How did you get on with the bugfix version? Did the problems continue?
[OnePlus 3 ROMs, Kernels, Recoveries, & Other Devel] abhibnl:
Apologies for the delay in respond but apparently i had to give my phone to my brother for the weekend so kept the stock kernel. Got it back today, should flash it and test. Will surely provide my findings once i test if thoroughly as per my daily usage.
[OnePlus 3 ROMs, Kernels, Recoveries, & Other Devel] Stroky:
Interesting that oneplus raised the voltage of the battery in the 3T to gain the 400 mAh.

Sounds for me like more harm to the battery in terms of longlife.
[OnePlus 3 ROMs, Kernels, Recoveries, & Other Devel] abhibnl:
[MENTION=6295391]bedalus[/MENTION]

Could you help me understand what do OnePlus mean when they said they were able to increase the voltage from 4.32 > 4.4? Are they using totally new batteries or is it something they have applied to the existing OP3 batteries?
[OnePlus 3 ROMs, Kernels, Recoveries, & Other Devel] bedalus:
Yep, I'm essentially doing the opposite with BLX. I'm reducing the threshold at which the charging stops, and they've increased it.

I'll be very interested to see the kernel differences. It might mean that I can further improve my BLX mod.
[OnePlus 3 ROMs, Kernels, Recoveries, & Other Devel] fcisco13:
Would be nice if we could swap battery
[OnePlus 3 ROMs, Kernels, Recoveries, & Other Devel] Stroky:
I think it is the same battery in both devices
[OnePlus 3 ROMs, Kernels, Recoveries, & Other Devel] abhibnl:
But the question still remains, did they completely opted for a new battery or it is a trick that can be applied via an OTA update to increase voltage capacity of the battery?
[OnePlus 3 ROMs, Kernels, Recoveries, & Other Devel] siankatabg:
The source code is already up in their github from some hours, but it might be incomplete and just copy/paste from our branch with some "aditions", since nobody can really test it. They may push the updates just before they start to ship it, but it will be interesting for me and many other here to read your founds there :) Keep it up, you are doing really good job :)

Come on guys... I'm absolutely noob at this battery stuffs and technologies, but there is no way ~1%(0.05V) increase in voltage to bring ~13%(400mAh) increase in the capacity in the same form factor battery with the same components and technology. With this logic we can up it to 4.45 and get nearly 4,000 mAh... Maybe in some unbranded China batteries it "will work", but not in the real world.

I've just read the xda "news" about the 3T and there are guys that talks about this in the comments, so basically if they are right(as I said I'm noob in this) this increase in voltage should decrease the capacity and not increase it(and definitely not with 13%) if it's the same battery.
[OnePlus 3 ROMs, Kernels, Recoveries, & Other Devel] bedalus:
I'm almost certain this is right. They're just charging it to a higher voltage.
[OnePlus 3 ROMs, Kernels, Recoveries, & Other Devel] bedalus:
I've had a good look through the 3T source (several hours in fact!) and I haven't turned up anything significant really. It looks like they're using the device tree to supply the voltages as parameters to the changing code, rather than having them hard-coded as they currently are in our source. At the moment the voltages look equivalent to ours, so perhaps they have yet to push the commits that tell that story.

I did notice there were some botched bits in our device tree which they'd fixed, so I've updated them. I also saw that in the oneplus source there was a code drop for 3.2.6 that I had no idea had happened! Pretty embarrassing for a kernel dev. Well, I guess I've been pretty absorbed by the BLX stuff for the last few weeks (that's my excuse and I'm sticking to it!).

I've also decided to switch from building -Os to -O2 (considered to be the standard optimisation level). There's some debate around whether or not the optimised code paths create a benefit versus shorter smaller code paths. This might seem paradoxical at first, but when you think about it, often the most efficient way to solve a problem involves a lot more instructions than a short but functional solution. At this point I'm just interested to see if there's any noticeable effect.

I'm satisfied that BLX works as intended at least when Dash-charging mode is active. I'm testing the device right now charging on a USB 3 port off my laptop. I've got a long youtube video of a fireplace which I'll then run to check if the battery graph comes out the same as it did when I ran it after a Dash charge. I'll post some screenshots of the results.
[OnePlus 3 ROMs, Kernels, Recoveries, & Other Devel] Stroky:
Very interesting!

Looking forward for V6 :)

I'm happy that I have now a chance to save my battery's long term performance.

Pretty cool and I was always looking for that.
[OnePlus 3 ROMs, Kernels, Recoveries, & Other Devel] abhibnl:
During these 24 hours, i haven't noticed anything weird. Apps works as they should and MC5 is working fine. Will report if anything weird happens.
[OnePlus 3 ROMs, Kernels, Recoveries, & Other Devel] Haggster66:
Hi bedalus, in between all the talk about battery mods, here's something else: Regarding the switch from -Os to -O2... I would suggest to build the exact same kernel with each and then run geekbench (or smth similar) several times with both.

My experience is that the scrores go down *slightly* when using -O2 compared to -Os. And by that I really mean that it almost doesn't matter, BUT in theory it gets worse. Especially since the old setting was already -Os, I would definitely check this, since this also affects the size of the kernel binary, so there's no reason to have a bigger binary which would consume some more kytes of our 10000s of kbytes of RAM, etc. etc. if it actually performs (ever so slightly) worse.

This is just a suggestion and you might've tested all this already, so kindly excuse my probably redundant post in that case :) My experience is also from a different CPU, and since this is highly CPU dependent, it might be the opposite here, hence the need for hard data, i.e. benchmarks.
[OnePlus 3 ROMs, Kernels, Recoveries, & Other Devel] bedalus:
I agree it needs testing on this platform to be sure, but it's been well tested by others: http://www.phoronix.com/scan.php?page=article&item=gcc_47_optimizations&num=5

Here's another thorough test: https://matt.sh/redis-benchmark-compilers

And I'm a strong advocate of thorough testing myself: http://xdaforums.com/nexus-s/general/ref-kernel-features-benchmarks-t1441905 (back on the Nexus S). I performed hundreds of tests! So don't worry, I'll get around to it, but right now I just want to ensure it doesn't cause any stability issues.
[OnePlus 3 ROMs, Kernels, Recoveries, & Other Devel] bedalus:
This is great news, I only reverted three commits in that version, so I can probably add them back in one at a time to see what causes the problem.

I'll work on that this evening. Thanks again for your help with testing!
[OnePlus 3 ROMs, Kernels, Recoveries, & Other Devel] Stroky:
I heard that there where new touchscreen drivers for the 3T for lower touch latency.

Isn't this interesting to add this to our device to?
[OnePlus 3 ROMs, Kernels, Recoveries, & Other Devel] abhibnl:
Sure, let me know what to test, weekend is fine for me to test anything.

[MENTION=6295391]bedalus[/MENTION]

Did u find anything like this during your review of the 3T kernel sources?
[OnePlus 3 ROMs, Kernels, Recoveries, & Other Devel] bedalus:
I'm not that interested in that at the moment. Chances are a lot of these developments will be released in an official update for our device soon anyway. If not, I'll take a look.
[OnePlus 3 ROMs, Kernels, Recoveries, & Other Devel] bedalus:
Thanks. I'll upload a new version for you before the weekend
[OnePlus 3 ROMs, Kernels, Recoveries, & Other Devel] crzykiller:
For all the guys saying Oneplus just upped the voltage on the battery, These are 4.35V lithium cells and they are rated at a maximum of 4.35V. You can't just up the voltage and expect increased battery capacity. The only thing that will happen is severe battery degradation if charged to 4.45V and above and possible fire since you're overcharging the battery. Its like taking a 18650 Lithium battery (max 4.20V for 99% of cells) and charging it to 4.3V. There is a 100% chance of battery damage and very small chance of fire. What is most likely the case is the battery is ever so slightly bigger, or since battery technology is advancing quite quickly, the battery density is slightly higher (the galaxy S7 battery is smaller than the S6 battery but its bigger)
[OnePlus 3 ROMs, Kernels, Recoveries, & Other Devel] bedalus:
Sounds convincing. I didn't find any evidence of voltage increases in the source. I assumed (wrongly) that there had been some development of the battery tech to allow higher voltages, but we've yet to see any utilisation of this. I think someone posted earlier in the thread that Oneplus were using higher voltages, and I'd taken this as a fact.

Thanks for setting the record straight.
[OnePlus 3 ROMs, Kernels, Recoveries, & Other Devel] bedalus:
I've done some careful testing of BLX to make certain that it's working. Here's a screenshot composite of my battery usage graph:

1) BLX=10; Fully charged (Dash): as soon as I start using it the state of charge [SOC] drops to about 80%. I didn't use the phone while I was at work and kept it in airplane mode. I took it out of airplane mode at lunch (I sometimes keep it in airplane because reception at work is so bad), which is when the graph shows a sudden jump in power drain rate.

2) BLX=10; Fully charged (Dash): I was going to start a test but must have been interrupted, as the SOC stays near full for a while. When I start my test the SOC drops quickly to 80% then starts draining at the normal rate. I was playing a youtube video of a fireplace on minimum brightness.

3) BLX=10; Fully Charged (USB 3): Using my laptop as a power source, the phone quickly registered a full SOC, however, as you can see from the graph, the charging began at 65% then suddenly jumped from about 68% to 100%. When I was running the test again, the SOC very quickly dropped straight back to point 4.

4) BLX=5; Begin charging (USB 3): I reset BLX to the medium setting and tried again. As you can see from the graph, the SOC increases more gradually versus Dash charging, up to about 85% then jumps to full at point 5. The device was left attached the the laptop overnight. I began the video in the morning at point 6, and this time the SOC dropped to about 80% which is the desired behaviour. Perhaps when using a USB power source to charge the device, BLX should be limited to 5. I may incorporate this into the code.

7) BLX=0; Begin Charging (Dash); I actually didn't have time to complete the charge as I was heading to work, so I took my Oneplus cable with me and completed the charge there via USB 2.

8) BLX=0; Fully Charged: Because I don't have reception or WiFi at work, the youtube video was just a black screen with a 'Tap to reload' message (or something) but it at least kept the sceen awake. With minimum brightness, and nothing actually happening (and the device was back in airplane mode), then drain is very minor.

Actually just checked my device since having taken it out of airplane this afternoon... it's now nearly 8:30pm and my SOC is 88%, which means it's lost about 1% per hour, maybe slightly less. That's a good result since my reception is so poor at work. Also it shows that BLX can be disabled and the SOC behaves as you would expect.

My next kernel release (V6) will feature BLX unless any of the testers have anything to report?
[OnePlus 3 ROMs, Kernels, Recoveries, & Other Devel] viper001:
Hi guys. One of my hobbies is electric RC planes. So I'd like to offer a bit of info about batteries.

The op3 has a 3000mah lipo battery.

Means that it is a lithium-polymer cell. A single cell. It's C or capacity is 3000mah.

A lipo cell normally has a range of 3v discharged state to 4.35 full charge. For RC use, to preserve battery longevity, full charge is @ 4.2V.

Normal charging is done @ 1C. Meaning, a 3000 mAh battery will charge completely in one hour if you push 3A into it.

Modern batteries can charge from 2 - 5C. This is what dash charge does it ramps up the Amps to charge faster. Fast charge does the opposite. It ramps up Voltage. basically, pushing in the current at a faster rate, which if not properly done can damage your battery.

My suggestion, instead of managing the final voltage, why not Cap the Amps. Fool the system into thinking it has a smaller battery. You'll get the same result without the problems of seemingly sudden drops in remaining power.
[OnePlus 3 ROMs, Kernels, Recoveries, & Other Devel] bedalus:
Hey [MENTION=4296062]abhibnl[/MENTION] here is the test version for you:

https://mega.nz/#!Hp1zlKKa!aENiQYZu92RXbeYBqBbFwsia3ErTfALqpdv9FTZyuMo

Can you check it with the same apps that were crashing and let me know if they behave?

Thanks again for your help.
[OnePlus 3 ROMs, Kernels, Recoveries, & Other Devel] bedalus:
Thanks for your insight. I had to learn a lot about battery tech while developing this mod, and I'm still learning! But I'm not sure that I fully understand what you're suggesting?
[OnePlus 3 ROMs, Kernels, Recoveries, & Other Devel] Wisniew:
Hi [MENTION=6295391]bedalus[/MENTION]

If You testing levels optimalization this can help You.

I tested almost all levels optimalization on my old kernel for Galaxy s3 and I can say some words about that.

-O0 - without any opti (recommend for debugging and testing code)

-O1 - small opti (recommend for normal desktop program and app to normally speed up and make more stable)

-O2 - medium opti (recommend for all system things like kernel because is the most stable and is enough fast to work on daily usage)

-O3 - high opti (recommend for... I don't know :D but this add speed and stability but this stability can be ruined on worse devices and devices will work better on -O2)

-Ofast - max opti (i don't know recommends for this too but i can say that this level focus on speed where stabiloty is better too but on not good devices this will give worse speed and stability. OP3 users that use -Ofast say that this devices is enough good for -Ofast)

-Os - size reduction ( is to reduce size to make more space in memory (disk and rams) i personalny don't recommend that because only reduce speed for good devices like op3 but this is good for very old phones or if someone want more ram and space on device)

-Oz - more size reduction (?) (I don't know anything about that but i remember that this more reduce then -Os maybe)

For OP3 I recommend -O3 or -Ofast because this devices is enough good for 3 and fast.

-O3 to -O2

Build with -O3 and -Ofast and give to test.
[OnePlus 3 ROMs, Kernels, Recoveries, & Other Devel] abhibnl:
Will test it for sure. BTW one question, I feel the battery levels are dropping quite a bit faster in the test version you shared with me. Like the battery drops to 92-93 really fast and then gets stable. The drop is aggressive till 80-ish and then it's normal. Was there anything in that test zip that could affect battery level or readings?
[OnePlus 3 ROMs, Kernels, Recoveries, & Other Devel] fcisco13:
I have tried 7 and 5 settings and it seems like dropping is more stable at 5.
[OnePlus 3 ROMs, Kernels, Recoveries, & Other Devel] bedalus:
The latest zip has BLX built in, but there's nothing in there that can affect charging unless you change the sysfs value, which you can't do by accident. But I'll double check to make sure.
[OnePlus 3 ROMs, Kernels, Recoveries, & Other Devel] abhibnl:
Actually, i didn't notice this before and would like to confirm. Does enabling Wifi Tethering keep yours device awake?
[OnePlus 3 ROMs, Kernels, Recoveries, & Other Devel] bedalus:
Thanks for your contribution. I already understand about the different optimisation levels. -O2 and -Os are considered safe for kernel builds. It's just a matter of determining which is generally the better option. -O2 will usually result in faster code, but longer. -Os will be shorter but less efficient. However, the shorter code is less likely to suffer cache misses. It's not clear cut which will net the fastest overall execution time.
[OnePlus 3 ROMs, Kernels, Recoveries, & Other Devel] bedalus:
I checked the code and there's nothing that can affect the voltages without first altering the cap_level. Did you charge it up on Dash, or USB? Have you had another full charge since then, and did you see the same thing? Anyway... how are you getting on with the kernel, any app crashes?

Thanks mate, really appreciate the help testing :)
[OnePlus 3 ROMs, Kernels, Recoveries, & Other Devel] viper001:
Hello sir. What I'm proposing is actually the opposite of what you've been doing. Instead of limiting the charge based on voltage.

There must be a line of code somewhere that tells the system that " the battery capacity is 3000mah" , just make it say it's 2800mah or lower. It's essentially the same as "lowering the final voltage" of the battery.
[OnePlus 3 ROMs, Kernels, Recoveries, & Other Devel] bedalus:
Thanks for clarifying. I can't find anything in the code regarding the battery mAh or a 3000 limit. The only reference to mAh is in the fuel-gauge code to mitigate the %age readout as the battery ages.
[OnePlus 3 ROMs, Kernels, Recoveries, & Other Devel] bedalus:
Yes, I think so.

Because I've been working on the BLX mod, my first instinct was that I left some testing parameter enabled. However, I've realised that it's got nothing to do with that. Perhaps your wifi tethering used up some power, but I've been testing compilation with the -O2 optimisation level, and I think I left that in your test version by mistake. This might have had an effect.

I'll build a new one for you without -O2 to be sure, but just out of curiousity, did you see any app crashes?

Edit: [MENTION=4296062]abhibnl[/MENTION] here you go https://mega.nz/#!yoV0GAyZ!udzQyELYLhzShpqStJGlRS5T8buXuHxVgDNO2mcsGlg
[OnePlus 3 ROMs, Kernels, Recoveries, & Other Devel] nevermorenorless:
Hi again! love the rom but wondering.. Could things like disabling crc and enabling ARCH_power better our device? Ive seen both work in other kernels and would try to make my own but time isnt really on my hands. If you are willing to give these a go ill gladly beta test for ya!
[OnePlus 3 ROMs, Kernels, Recoveries, & Other Devel] bedalus:
I don't think so... These are pretty unusual suggestions. Which kernels are touting these mods? Please provide links if you can and I'll go investigate.
[OnePlus 3 ROMs, Kernels, Recoveries, & Other Devel] bedalus:
Moxie v6: The BLX release!

Changed since V5:

- Bring in OnePlus updates to bring kernel up to their 3.2.6 level (latest)

- Synchronise device table parameters with 3T kernel sources

- Added Battery Life eXtender [BLX]

To enable BLX edit:

/sys/class/misc/batterylifeextender/charging_cap_level

to any value from zero (disabled) to 10 (full BLX).

BLX prevents your battery from charging to its full capacity. Why is this useful? Because charging your battery reduces its capacity over time. To help prevent this, I've designed this mod to cut off the battery charging earlier.
[OnePlus 3 ROMs, Kernels, Recoveries, & Other Devel] SREEPRAJAY:
This is done using the terminal?

Just to let know everyone is in the same level of info...thanks for the effort and hard work sir
[OnePlus 3 ROMs, Kernels, Recoveries, & Other Devel] bedalus:
Zero (0) is default, i.e. BLX disabled. 10 is the maximum setting and the battery will charge to about 80%. I'm using level 10.

It can be done with the terminal:

echo 10 > /sys/class/misc/batterylifeextender/charging_cap_level

...however, I'm just using the text editor function in my file explorer. It works the same way. Change the number to 10, save and close.
[OnePlus 3 ROMs, Kernels, Recoveries, & Other Devel] corrupt1234:
Woah nice feature. Does this mean i can set the phone to stop charging when it reaches, say, 90%?
[OnePlus 3 ROMs, Kernels, Recoveries, & Other Devel] nevermorenorless:
http://xdaforums.com/zenfone2/development/mm-kernel-project-t-mm-t3458478 for example, installed it on my old phone and it does have a huge i/o boost in not only benchmarks but realtime use. As for ARCH_Power I heard it helps with the battery life on laptops.. Wondering if it will work on a phone.
[OnePlus 3 ROMs, Kernels, Recoveries, & Other Devel] chinmai560621:
Regarding the optimisation levels, O2 and O3 are tested and stable on our device. And does this kernel support f2fs? If not, can you make it? I'm truly impressed by your new addition, which value do you recommend for it? And also, switching off LMK and touchboost helps a lot; implement this. Also, reduction of input boost values has a positive impact on battery.

I haven't used any kernel tuner, so if I had mentioned any feature that Is already there, sorry.
[OnePlus 3 ROMs, Kernels, Recoveries, & Other Devel] bedalus:
Yeah, the required value will be 5. Have a read through the last few pages to get an idea of what the expected behaviour would be. You might find this post useful: http://xdaforums.com/showpost.php?p=69671595&postcount=266

A lot of IO tweaks involve disabling safety mechanisms, this might be something I'm unwilling to do, but I'll take a look. Appreciate the link :) EDIT: Ok, I gave this a quick check, and it doesn't improve any scores

Do you know who tested O2 and O3 and did they make their test results public? I did my own testing and Os was getting far superior results. I don't support F2FS, but maybe in the future. I recommend a value of 10 in BLX. What's LMK? Phew!