Charging Optimization
Developed by @user244945
Charge Turbo Module
A charge control and thermal management module for rooted Android devices. The module ID is turbo-charge. This repository is continuously maintained based on the original project, adding features such as three-stage temperature control, charge-stop based on battery level, bypass charging, Meizu device adaptation, expanded thermal control paths, and a WebUI.
[!CAUTION]
This module modifies/syscharging nodes and may stop or bypass certain system thermal control policies. Incorrect configuration can result in device overheating, battery life degradation, charging anomalies, reboots, or hardware damage. Use at your own risk.
Project Origin and Attribution
This project retains and acknowledges the following upstream work:
- chase535/turbo-charge: The original base project, authored by Coolapk user @Nuojiya.
- Coolapk user @MisakaThepoor: For the thermal control removal solution and related detection/mounting concepts.
- @tanxue0118 / A Dreaming Cat: Current repository maintenance and secondary development.
When citing, modifying, or distributing this project, please retain the upstream sources, author, and contributor statements, and comply with the AGPL-3.0-only license.
Main Features
Charging and Battery Level Control
- Automatically scans for writable charging current, charging pause, and step charging nodes on the device.
- Allows setting the maximum charging current and toggling step charging off.
- Monitors the configuration file via inotify, allowing on-the-fly reloading after modifications.
- Battery level control uses hysteresis logic: it triggers upon reaching
CHARGE_STOPand recovers when dropping toCHARGE_START, preventing frequent toggling around a single threshold. - Upon reaching the target battery level, you can choose to stop charging entirely or request bypass charging.
Bypass Charging
Bypass charging can be triggered by battery level thresholds or specific foreground applications:
- Prioritizes probing standard
power_supplyinterfaces and dedicated nodes containing "bypass" in their name. - Verifies if the node genuinely takes effect by writing the hardware bypass value and then re-reading it.
- Saves the node's original value before enabling, and attempts to restore it when exiting bypass, unplugging the power source, or terminating the process.
- If the device lacks a verifiable hardware bypass node but has a current control node, it falls back to a
500000 μA(500 mA) compatibility mode. - Logs an entry if neither hardware bypass nor compatibility mode is available, and retries probing in subsequent loops.
Note: The 500 mA compatibility mode is merely a low-current power supply solution and is not equivalent to a true hardware bypass. Whether the charger can directly handle the system load depends on the device kernel, charging IC, and the manufacturer's driver implementation.
Once BYPASS_CHARGE=1 is enabled, you can add application package names (one per line) in bypass_charge.txt. Bypass is requested when the target application is in the foreground and the screen is on; it restores the original state upon leaving the app, turning off the screen, unplugging the power source, or disabling the feature.
Three-Stage Temperature Control
- Stage 1: Implements mild current limiting using
TEMP_LEVEL1_CURRENTwhen the temperature reachesTEMP_LEVEL1. - Stage 2: Implements further current limiting using
TEMP_LEVEL2_CURRENTwhen the temperature reachesTEMP_LEVEL2. - Stage 3: Stops charging entirely when the temperature reaches
TEMP_MAX. - Restores the charging state as the temperature drops, preventing frequent toggling caused by a single high-temperature threshold.
Thermal Control Path Mounting
- Uses bind mount to map placeholder files within the module to the system's thermal configuration paths.
- Currently,
module/thermal_filesincludes 487 thermal-related paths covering locations likesystem,vendor,product, andsystem_ext. - Supports recursive scanning and mounting up to a limit of 1024 paths, while retaining compatibility paths for older devices.
- Offers the choice of global mounting or mounting only while charging.
Other Features
- Battery temperature simulation, which can be applied globally or only while charging.
- Meizu device adaptation, supporting the Flyme clearing solution and the extremegt relaxation solution.
- Thermal service handling for OPPO, realme, and OnePlus, plus Xiaomi cloud control directory management.
- A WebUI that displays real-time battery level, temperature, current, power, and operation logs, and allows editing of module configurations.
Common paths after installation:
Configuration File: /data/adb/modules/turbo-charge/option.txt
Bypass List: /data/adb/modules/turbo-charge/bypass_charge.txt
Runtime Log: /data/adb/modules/turbo-charge/log.txt
Main Executable: /data/adb/modules/turbo-charge/bin/turbo-charge
Main Configurations
| Configuration Item | Description | Default Value |
|---|---|---|
CYCLE_TIME | Main loop interval, in seconds | 1 |
CURRENT_MAX | Maximum charging current, in μA | 50000000 |
STEP_CHARGING_DISABLED | Toggle to disable step charging | 0 |
TEMP_CTRL | Toggle to enable three-stage temperature control | 1 |
TEMP_LEVEL1 | Stage 1 temperature threshold, in Celsius | 45 |
TEMP_LEVEL1_CURRENT | Stage 1 current limit, in μA | 3000000 |
TEMP_LEVEL2 | Stage 2 temperature threshold, in Celsius | 50 |
TEMP_LEVEL2_CURRENT | Stage 2 current limit, in μA | 1000000 |
TEMP_MAX | Stage 3 high-temp charge-stop threshold, in Celsius | 52 |
POWER_CTRL | Toggle to enable battery level control | 0 |
CHARGE_STOP | Battery level threshold to stop charging or enter bypass | 95 |
CHARGE_START | Battery level threshold to resume charging or exit bypass | 80 |
POWER_CTRL_MODE | 0 for stop charging, 1 for bypass charging | 0 |
BYPASS_CHARGE | Toggle to enable foreground app bypass | 0 |
TEMP_SIMULATE | Toggle to enable battery temperature simulation | 0 |
THERMAL_MOUNT_MODE | 0 for global mount, 1 for mount during charging only | 0 |
MEIZU_DEVICE | Toggle to enable Meizu device adaptation | 0 |
For the full configuration and comments, refer to module/option.txt.
Execution Flow
module/service.shwaits for Android boot completion and finishes vendor-specific initialization.- Starts
module/bin/turbo-charge, writing standard output and error output tolog.txt. - The main program reads the configuration, scans device nodes, and starts the configuration listener and control loop.
- Executes current control, charge-stopping, bypass charging, temperature simulation, and thermal path mounting based on external power, battery level, temperature, screen, and foreground app status.
- Reloads configuration upon changes; attempts to restore previously saved node states whenever features are disabled, power is unplugged, or the program exits.
Repository Structure
charge-turbo/
├─ module/ Current Magisk Module
│ ├─ META-INF/ Installation Entry
│ ├─ bin/turbo-charge AArch64 Android Main Executable
│ ├─ thermal_files/ Thermal Control Path Files
│ ├─ meizu_files/ Meizu Adaptation Files
│ ├─ webroot/ WebUI
│ ├─ action.sh
│ ├─ bypass_charge.txt
│ ├─ customize.sh
│ ├─ module.prop
│ ├─ option.txt
│ ├─ service.sh
│ └─ uninstall.sh
├─ Source_Code/
│ └─ Modularized/ Official Main Source Code
├─ LICENSE Full AGPL-3.0-only License text
└─ README.md
Open Source License
This project is released under the GNU Affero General Public License v3.0 only (AGPL-3.0-only). For the full terms, see LICENSE.
If you distribute a modified version or offer the functionality of the modified program to users over a network, you must retain the copyright and license notices and provide complete, modifiable source code to the corresponding users as required by AGPL-3.0.
This project is provided without any express or implied warranties. Users must evaluate and bear the risks associated with device compatibility, data security, battery health, and hardware.
Reviews (0)
No reviews yet. Be the first to review!