[Hero CDMA Android Development] collin_ph:
UPDATE 8/24! Please go to the site and download the latest version RC1b which corrects 2 small bugs people have reported. It now sets the proper permissions on batt-diag so it runs, and it changes the way the program tries to SU so that you can choose to not have the program attempt to run SU if your rom has trouble running su from terminal;

---Original Below---

I decided to create a new forum for the latest battery tweak as so much has changed since the initial versions.

To get things started, I'll just say that collin_ph battery tweak is a collection of scripts designed to make the hero (for now) last longer on battery, run faster, and run better. The tweak includes CPU management, Battery Management, Disk Performance Boost, Scheduler Boost, LED Fix, Audio Quality boost and other features to improve the usability of your Hero.

Instructions: Go to http://www.primoweb.com/froyo to download the latest version and get the documentation.

Boot into recovery and flash the zip file.

After reboot, you may run batt-cfg from shell or terminal (Note, that the scripts will all request root access, so there's no longer a need to su before running them).

to run batt-cfg

go to terminal in the phone or use adb shell from your PC

once there, type

batt-cfg

It will pull up a menu of choices. For further info, see http://www.primoweb.com/froyo

You can load a 691 mhz default (most Cyanogen kernels now only support up to 691 mhz anyway), or, if you have an uncapped kernel, you can choose a 768 mhz setting. Note: Both settings actually run at 691 when on battery and only run higher when plugged in.

The basics of how the battery is extended is that this tweak causes your phone to scale down (to lower frequencies) faster and to scale up slower. In stock configuration, the cpu scales up when only under 70% load -- while part of this tweak causes it not to scale until it's at 95% load, avoiding unnecessary scaling and battery drain. A second (and arguably more important) feature, is that as the battery drains, it lowers the maxumum CPU frequency. So when you have 1% battery left, you may be running at 468mhz instead of 691. Another plus is that the phone runs in a "higher performance" mode while charging via AC, and another mode to make sure the phone is actually charging when connected bia USB, in addition to the settings mentioned above when the phone is on battery.The best part is that almost every parameter in the system is adjustable through terminal or adb shell using a program called batt-cfg -- just run it and you'll be presented with a menu of options.

I'm constantly updating the documentation, so please check back often as I'll update this thread until there's a final 3.0 version. We're already working on a 4.0 which will be available on the market. We'll post more info there as it happens at www.tweaktool.com

COMPATIBILITY NOTES:

This tweak only works with clockable kernels. A lot of ROMS have reclockable or overclockable kernels which should work. I recommend Froyo roms, but I have heard of the tweak running with 2.1 releases. The main incompatibility seems to be with the service startup-- on some roms, the service doesn't automatically start up.

to verify if your rom is compatible and that the tweak is working, reboot.

Then go to terminal or adb shell and type:

pidof batt.sh

if it returns a number, then the service is running. If not, you'll have to start it manually every time the phone reboots by going to terminal or adb shell and typing

batt-cfg

then choose the option to save and exit. This will manually start or restart the service. Note: if your rom does not start the service automatically, you'll have to do the above batt-cfg procedure after EVERY boot or battery tweak will not run.

If you're a ROM developer, you'll can probably make your ROM compatible by adjusting your rom (ramdisk) to call (import) /system/etc/init.local.rc from init.rc -- assuming your ROM has an overclockable kernel like fresh, darch, or others.

ROMS based on unclockable kernels like Damage Control, won't work without a kernel upgrade and may still not start the service automatically upon reboot.

Thanks to Decad3nce for testing and improving several parts of the battery tweak.